Agentic AI - Agent ObservabilityWhich of the following is the correct way to log a tool call and its result in a simple Python function?Adef log_call(tool_name, result): print(f"Tool {tool_name} result")Bdef log_call(tool_name, result): return f"Tool {tool_name} returned {result}"Cdef log_call(tool_name, result): print("Tool tool_name returned result")Ddef log_call(tool_name, result): print(f"Tool {tool_name} returned {result}")Check Answer
Step-by-Step SolutionSolution:Step 1: Check string formatting with variablesdef log_call(tool_name, result): print(f"Tool {tool_name} returned {result}") uses f-string correctly to insert variables tool_name and result.Step 2: Verify output methoddef log_call(tool_name, result): print(f"Tool {tool_name} returned {result}") prints the message, which is typical for logging in simple scripts.Final Answer:def log_call(tool_name, result): print(f"Tool {tool_name} returned {result}") -> Option DQuick Check:Correct f-string and print used [OK]Quick Trick: Use f-strings and print() to log calls and results [OK]Common Mistakes:Not using f-string for variable insertionPrinting literal variable names instead of valuesReturning string instead of printing
Master "Agent Observability" in Agentic AI9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepModelTryChallengeExperimentRecallMetrics
More Agentic AI Quizzes Future of AI Agents - AGI implications for agent design - Quiz 7medium Future of AI Agents - Autonomous web browsing agents - Quiz 5medium Future of AI Agents - Autonomous web browsing agents - Quiz 9hard Production Agent Architecture - Agent API design patterns - Quiz 14medium Production Agent Architecture - Agent API design patterns - Quiz 13medium Production Agent Architecture - Async agent execution - Quiz 13medium Real-World Agent Applications - Data analysis agent pipeline - Quiz 13medium Real-World Agent Applications - Content creation agent workflow - Quiz 14medium Real-World Agent Applications - Research assistant agent - Quiz 14medium Real-World Agent Applications - Personal assistant agent patterns - Quiz 7medium