Create Simple Agent
Learn how to build your first autonomous agent that can search the internet using the SVAHNAR framework.
This guide walks you through configuring a basic Web Search agent. The agent will use a Large Language Model (LLM) to reason, tools to access live data, and a natural language instruction to execute its task.
💡 Core Concepts
Before writing the configuration, it is helpful to understand the structure of a SVAHNAR agent.
1. The Agent Network
Every agent lives inside a network container. The top-level key create_agent_network defines this boundary. Think of it as the "team" that your agent belongs to.
Even a single agent exists inside a create_agent_network block. This allows you to easily scale from one agent to many without rewriting your code.
2. The Agent "Anatomy"
A simple agent requires four key components to function:
- LLM Config: The "Brain" (e.g., GPT-5).
- Tools: The "Hands" (e.g., Web Search).
- Function: The "Mission" (Instructions in plain English).
- Edges: The "Flow" (When to start and stop).
⚙️ Configuration Steps
Follow these steps to build your agent from scratch using YAML.
Initialize the Network
First, define the network container and your agent's ID.
create_agent_network: The root of your configuration.agent-1: A unique ID for the agent within this network.agent_name: A human-readable name (e.g., "Web_search").
create_agent_network:
agent-1:
agent_name: "Web_search"
For deep dives on network structure, see Initialization.
Configure the "Brain" (LLM)
Next, specify which model powers the agent. You can control parameters like max_tokens (response length) and request_timeout (patience).
LLM_config:
params:
model: "gpt-5"
max_tokens: 1000
request_timeout: 600
See the full list of supported models in LLM Configuration.
Equip Tools
Give your agent capabilities beyond standard text generation. Here, we assign the Tavily tool to enable internet access.
tools:
tool_assigned:
- name: "Tavily"
config:
max_results: 5
API_key: abcd # or API_key: ${TAVILY_API_KEY}
max_results: Limits the search tool to the top 5 most relevant links to ensure concise answers.
Explore other available tools in the Tools Documentation.
Define the Mission
Tell the agent what to do using natural language in the agent_function block.
agent_function:
- "Your function is to search the web or internet for information"
Pro Tip Be specific. The clearer your instruction, the better the agent performs. Learn more in Agent Function Documentation.
Set the Flow (Edges)
Finally, define how the agent connects to the rest of the world.
incoming_edge:
We use "Start"(case-sensitive) to indicate this agent runs immediately when the application launches.
outgoing_edge:
We leave this empty [] because this is a simple, standalone agent that doesn't pass work to anyone else.
incoming_edge:
- "Start"
outgoing_edge: []
To build complex workflows with multiple agents, read about Incoming and Outgoing Edges.
📚 Practical Recipes (Examples)
Full Web Search Agent Use Case: A standalone agent that accepts a user query, searches the web, and returns a summary.
create_agent_network:
agent-1:
agent_name: "Web_search"
LLM_config:
params:
model: "gpt-5"
max_tokens: 1000
request_timeout: 600
tools:
tool_assigned:
- name: "Tavily"
config:
max_results: 5
API_key: abcd # or API_key: ${TAVILY_API_KEY}
agent_function:
- "Your function is to search the web or internet for information"
incoming_edge:
- "Start"
outgoing_edge: []
🚑 Troubleshooting
-
Agent not starting?
- Ensure incoming_edge is set to ["Start"] (case-sensitive). Without this, the agent waits for a signal that never comes.
-
Search failing?
- Verify you have configured your Tavily API Key in your YAML configuration file or Key Vault.
-
YAML Syntax Errors?
- Check your indentation. YAML is whitespace-sensitive; ensure nested keys (like params under LLM_config) are indented correctly.