Build Your First Chainless Agent
Let’s create a simple AI agent using Chainless that can utilize tools and collaborate with other agents to complete a task. Make sure you havechainless
installed. If not, follow the installation guide first.
1
Set Your OpenAI API Key
Chainless supports various LLM providers. In this example, we’ll use OpenAI’s GPT-4 model by setting the required environment variable:
2
Define a Tool Function
Tools are callable functions that your agents can use. Let’s define a simple search tool:
3
Create Your Agent
Agents are the core of Chainless. They use tools and respond to tasks. Here’s a simple agent setup:
4
Run the Agent Manually
You can invoke the agent directly by calling
start()
:5
Orchestrate with TaskFlow
For more complex, multi-step tasks, use
TaskFlow
: