LoslegenKostenlos loslegen

Tracing the Agent’s Code Execution

You've preserved memory in your travel assistant agent, and it successfully remembered your flight confirmation number. Now, you're curious about how it computed or stored that information.

To find out, you'll inspect the full code the agent executed across both steps using its built-in memory.

Diese Übung ist Teil des Kurses

AI Agents with Hugging Face smolagents

Kurs anzeigen

Anleitung zur Übung

  • Call the .return_full_code() method on the agent's memory to retrieve all executed code.
  • Print the returned code so you can see everything the agent ran during the session.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Inspect the code executed by the agent
executed_code = travel_agent.memory.____()

print("Executed code during session:")
print("=" * 50)
print(executed_code)
Code bearbeiten und ausführen