Create agent example
Let's create an agent with the API.
Research assistant agent
This agent completes the following tasks:
- Search the web when users ask questions requiring current information.
- Limit search results to
20for comprehensive responses. - Use a lower temperature (
0.3) for more consistent, factual responses. - Follow instructions to cite sources and admit uncertainty when appropriate.
- Configure retry logic to handle transient API failures gracefully.
This example requires no corpus setup, making it perfect for immediate testing.
COMPLETE AGENT CHAT EXAMPLE
Code example with bash syntax.1?
Test your agent with the console UI
- Navigate to Agents in the sidebar and find this research assistant agent.
- In the agent details page, click the Chat tab.
- Try asking quetsions like:
"What are the main benefits of solar energy for average Texas homes?" - You should see the agent search the web and provide a cited response.
Expected response
The agent acts as follows:
- Uses web search to find current information.
- Provides a summary with key points.
- Includes source citations.
- Shows tool usage in the response events.
Response format
The agent responds with events that include:
input_message: Your original messagethinking: The agent's reasoning process (optional)tool_input/tool_output: Web search execution and resultsagent_output: The final response with citations.