Bird
Raised Fist0
Agentic AIml~10 mins

Logging tool calls and results in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to log the start of a tool call.

Agentic AI
logger.[1]("Starting tool execution")
Drag options to blanks, or click blank then click option'
Adebug
Binfo
Cwarn
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' or 'warn' for normal tool start logs.
2fill in blank
medium

Complete the code to log the result of a tool call.

Agentic AI
logger.[1](f"Tool result: {result}")
Drag options to blanks, or click blank then click option'
Awarn
Bdebug
Cerror
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'debug' which might be too detailed for results.
3fill in blank
hard

Fix the error in the logging call to correctly log an exception.

Agentic AI
logger.error(f"Tool failed with error: {error}", [1]=True)
Drag options to blanks, or click blank then click option'
Atraceback
Bexception
Cexc_info
Derror_info
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect argument names like 'exception' or 'traceback'.
4fill in blank
hard

Fill both blanks to log the tool call and its duration.

Agentic AI
logger.[1](f"Tool {tool_name} called")
logger.[2](f"Duration: {duration} seconds")
Drag options to blanks, or click blank then click option'
Ainfo
Bdebug
Cwarn
Derror
Attempts:
3 left
💡 Hint
Common Mistakes
Using error or warn for normal tool call logs.
5fill in blank
hard

Fill all three blanks to log tool call, result, and error if any.

Agentic AI
logger.[1](f"Calling tool: {tool_name}")
logger.[2](f"Result: {result}")
if error:
    logger.[3](f"Error: {error}", exc_info=True)
Drag options to blanks, or click blank then click option'
Ainfo
Bdebug
Cerror
Dwarn
Attempts:
3 left
💡 Hint
Common Mistakes
Logging errors without exc_info, or using info for errors.