Quickstart

Here is a quick tutorial to build and run a simple AI Agent with SwarmZero.ai

Project Requirements
  • Python >= 3.11

Setup

First import the Agent class:

from swarmzero import Agent

Load your environment variables:

from dotenv import load_dotenv
load_dotenv()
Create an Instance and Run the Agent

Then create an Agent instance:

my_agent = Agent(
    name="my_agent",
    functions=[],
    instruction="your instructions for this agent's goal",
)

my_agent.run()
Call the Agent

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 here.

Last updated

Logo

© 2024 SwarmZero Technology Solutions Inc. All rights reserved.