Latitude Agents are an advanced prompt type that enables AI models to operate autonomously, breaking down complex tasks, using tools, and reasoning through multiple steps until a final goal is achieved.
Unlike simple prompts or even Chains which follow predefined steps, Agents can dynamically decide their next action based on the context and available tools.
When you finish reading this page you can read our take on Anthropic’s building agents article
Defining an Agent
To turn a prompt into an Agent, simply addtype: agent to its configuration block:
How the Agent Loop Works
When an Agent prompt is run:- Goal Understanding: The agent analyzes the initial prompt to understand the overall task or goal.
- Planning (Implicit): It internally plans the first step needed to move towards the goal.
- Action: It decides whether to: a. Call a Tool: If it needs external information or functionality, it requests a tool call. b. Generate Response: If it has enough information or needs to ask a clarifying question, it generates text.
- Observation: If a tool was called, it receives the tool’s response.
- Reasoning: Based on the goal, previous steps, and new observations (tool responses), it reasons about the next action needed.
- Repeat: Steps 3-5 repeat until the agent determines the original goal is fully accomplished.
- Final Answer: The agent provides the final result.
Using Tools Within Agents
Agents become truly powerful when combined with Tools. Provide the agent with a set of relevant tools, and it will decide which ones to use and when.- Realize it needs a location ID for
get_weather. - Call
get_location_idwithlocation_name. - Receive the
location_id. - Call
get_weatherwith the obtainedlocation_id. - Receive the weather data.
- Formulate and return the final answer to the user.
Defining the Final Output (Schema)
You can guide the agent’s final output by specifying a responseschema using JSON Schema:
Predefined Steps
While agents operate autonomously, you can provide initial instructions or force specific actions using<step> tags. The agent will execute these predefined steps first before entering its autonomous loop.
Limiting Agent Iterations
To prevent agents from running indefinitely (e.g., getting stuck in loops), Latitude automatically applies amaxSteps limit of 20 to all prompts with configuration. This controls the maximum number of steps (tool calls + LLM responses) an agent can execute.
You can customize this limit by explicitly setting the maxSteps configuration option (max: 150):
Running Agents
Agents are run just like any other prompt using the API or SDKs. The response will typically be a stream of events detailing the agent’s thought process, tool calls, and final answer.Subagents
You can make any prompt have access to other agents in your project by using theagents configuration option. This allows you to create a hierarchy of agents, where tasks are delegated to subagents with specific responsibilities.
Next Steps
- Our take on Anthropic’s building agents article
- Explore Latitude Tools that agents can use.
- Test your agents in the Playground.
- Learn about Evaluations to assess agent performance.