Learn how to write prompts and other context engineering techniques for your agents.
description
, instructions
and a number of other settings. The description
is added to the start of the system message and instructions
are added as a list. For example:
additional_context
parameter.
In this example, we add additional context to the system message that the agent has access to specific tables in a database.
Parameter | Type | Default | Description |
---|---|---|---|
description | str | None | A description of the Agent that is added to the start of the system message. |
instructions | List[str] | None | List of instructions added to the system prompt in <instructions> tags. Default instructions are also created depending on values for markdown , expected_output etc. |
additional_context | str | None | Additional context added to the end of the system message. |
expected_output | str | None | Provide the expected output from the Agent. This is added to the end of the system message. |
markdown | bool | False | Add an instruction to format the output using markdown. |
add_datetime_to_context | bool | False | If True, add the current datetime to the prompt to give the agent a sense of time. This allows for relative times like “tomorrow” to be used in the prompt |
add_name_to_context | bool | False | If True, add the name of the agent to the context. |
add_location_to_context | bool | False | If True, add the location of the agent to the context. This allows for location-aware responses and local context. |
add_session_summary_to_context | bool | False | If True, add the session summary to the context. See sessions for more information. |
add_memories_to_context | bool | False | If True, add the user memories to the context. See memory for more information. |
add_dependencies_to_context | bool | False | If True, add the dependencies to the context. See dependencies for more information. |
add_knowledge_to_context | bool | False | If True, add retrieved knowledge to the context, to enable RAG. See knowledge for more information. |
system_message | str | None | Override the default system message. |
build_context | bool | True | Optionally disable the building of the context. |
system_message
parameter. This will ignore all other settings and use the system message you provide.
llama-3.2-11b-vision-preview
on
Groq, require no system message with other messages. To remove the system
message, set build_context=False
and system_message=None
.
Additionally, if markdown=True
is set, it will add a system message, so
either remove it or explicitly disable the system message.input
sent to the Agent.run()
or Agent.print_response()
is used as the user message.
See dependencies for how to do dependency injection for your user message.
add_history_to_context
.
additional_input
parameter.
These messages are added to the context as if they were part of the conversation history.
You can give your agent examples of how it should respond (also called “few-shot prompting”):