Last updated 5 months ago
Was this helpful?
Here is a quick tutorial to build and run a simple AI Agent with SwarmZero.ai
Python >= 3.11
First import the Agent class:
Agent
from swarmzero import Agent
Load your environment variables:
from dotenv import load_dotenv load_dotenv()
Then create an Agent instance:
my_agent = Agent( name="my_agent", functions=[], instruction="your instructions for this agent's goal", ) my_agent.run()
Finally, call the API endpoint, /api/v1/chat, to see the result:
curl --request POST \ --url http://localhost:8000/api/v1/chat \ --header 'Content-Type: multipart/form-data' \ --form 'user_id="test"' \ --form 'session_id="test"' \ --form 'chat_data={ "messages": [ { "role": "user", "content": "Who is Satoshi Nakamoto?" } ] }'
For more clarification and other examples of code, read the tutorial .