Configure an Agent: Advanced Settings
Configure advanced model and agent parameters.
About This Task
- For full Agent component documentation, see Agent.
- For an explanation of Agent's workflow, see AI Agent.
Prerequisites
Complete the following tasks before you start: Configure an Agent: Model, System Prompt, and Tools.
Access Agent's Advanced Settings
- In Builder, click Model on the Agent component card to open its configuration panel.
- Switch to the Advanced tab.
- Configure the settings as needed. The Parameters section contains model-specific settings. For details on how to configure the model, refer to the model's documentation.
The Other section contains Agent-specific settings:
max_agent_steps: The maximum number of actions the agent can perform. For more complicated tasks, you may need to increase this value. Note that increasing this value may increase the cost and time of the task.exit_conditions: The conditions that cause the agent to stop. For example, you can configure the Agent to stop after a tool is used or once the model returns a text response.- To stop the agent when it generates a text response, choose
text. - To stop the agent after a specific tool is used, choose the tool's name from the list.
- You can choose multiple exit conditions and the agent stops when any of the conditions is met. For example, to stop the agent when it generates a text response or after a specific tool is used, choose
textand the tool's name.
- To stop the agent when it generates a text response, choose
retry_on_tool_failure: Automatically retries the agent if a tool call fails. This is useful if the tool call times out or temporarily fails.
Configure a Different Model
In Agent YAML
You can choose a model other than those available in the Model list. This requires you to switch to YAML and set the model there. Model is provided to the Agent using the chat_generator parameter. Use the chat_generator parameter to do this. Make sure there is a ChatGenerator component for the model you want to use. Make sure Haystack Platform is connected to the model provider. For details on how to connect, see Using Hosted Models and External Services.
For example, to use a model hosted on Together AI, pass TogetherAIChatGenerator as the value of the Agent's chat_generator parameter:
agent:
init_parameters:
chat_generator:
type: haystack_integrations.components.generators.togetherai.chat.chat_generator.TogetherAIChatGenerator
init_parameters:
api_key: {"type": "env_var", "env_vars": ["TOGETHERAI_API_KEY"], "strict": false}
model: deepseek-ai/DeepSeek-R1
generation_kwargs:
max_tokens: 650
temperature: 0
seed: 0
Through Custom Model Definition
You can also create a custom model definition and use it in the Agent. For details, see Add Custom Model Definitions.
Set Chat History Granularity Beta
When an agent pipeline runs in a multi-turn conversation, the platform replays past conversation turns to the agent on each new request. You can control how much of the chat history is replayed.
There are two modes:
query_answer(default): Only the user's query and the agent's final answer from each past turn are included. This is compact and works well for most conversational use cases.all_messages: Every message from each past turn is included — tool calls, tool results, reasoning steps, and the final answer. Use this when the agent needs the full context of previous interactions, for example when follow-up requests depend on which tools were called or what results they returned.
In the Pipeline YAML
Set the granularity in the pipeline YAML under the history key:
history:
granularity: all_messages
Accepted values are all_messages and query_answer (lowercase). The YAML setting acts as a default and is overridden by any value passed in the API request.
For details on the available values, when to use each, and how to override the setting per request through the API, see Enable Streaming: Stream Request Parameters.
Was this page helpful?