How do I retrieve the agent's system prompt (instr...
# ask-ai
c
How do I retrieve the agent's system prompt (instructions) from the agent class?
t
Thanks for reaching out, Anton. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you retrieve the agent's system prompt (instructions) from the agent class! You can easily access this by using the
instructions
property of the
Agent
class. This property holds the core instructions that were set during the initialization. Here's a simple example to guide you:
Copy code
agent = Assistant(tools=tools)  # Example agent instantiation
system_prompt = agent.instructions
print(system_prompt)  # Outputs the system instructions
For more advanced setups, like with the
TriageAgent
, the instructions might be loaded from a file (such as a YAML file), but you can still access them through the same
instructions
property. Plus, if you ever need to change these instructions on the fly, the
update_instructions
method makes that possible during runtime. Sources: examples/voice_agents/realtime_joke_teller.py | complex-agents/medical_office_triage/triage.py | Workflows | LiveKit Docs