Welcome to DeepCore! This guide will help you create your first AI agent in just a few minutes. Let's get started!
Prerequisites
Before you begin, make sure you have:
Python 3.11+
pip or poetry
Basic understanding of Python
An API key for your preferred AI model (e.g., OpenAI, Claude)
Installation
# Using pip
pip install deepcore
# Or using poetry
poetry add deepcore
1. Create Your First Agent
from deepcore import Agent
# Initialize a simple agent
agent = Agent(
name="my_first_agent",
description="A helpful assistant",
model="gpt-4" # or any other supported model
)
# Start a conversation
response = agent.chat("Hello! Can you help me with some data analysis?")
print(response)
2. Add Tools to Your Agent
from deepcore.tools import Calculator, WebSearch
# Create an agent with tools
agent = Agent(
name="powered_agent",
description="An agent that can calculate and search",
model="gpt-4",
tools=[Calculator(), WebSearch()]
)
# Ask the agent to use tools
response = agent.chat("What is the square root of 144 plus the current temperature in New York?")
print(response)
3. Create a Custom Tool
from deepcore.tools import BaseTool
class WeatherTool(BaseTool):
def __init__(self):
super().__init__(
name="weather",
description="Get weather information"
)
async def _run(self, location: str) -> str:
# Implement weather checking logic
return f"Weather information for {location}"
# Use your custom tool
agent = Agent(
name="weather_agent",
tools=[WeatherTool()]
)
4. Multi-Agent Collaboration
from deepcore import Agent, Team
# Create specialized agents
researcher = Agent(name="researcher", tools=["web_search"])
analyst = Agent(name="analyst", tools=["calculator"])
writer = Agent(name="writer", tools=["text_processor"])
# Create a team
team = Team(
name="research_team",
agents=[researcher, analyst, writer]
)
# Let the team work together
result = team.collaborate("Research the impact of AI on healthcare and prepare a report")
5. Deploy Your Agent
from deepcore.deploy import APIServer
# Create an API server
server = APIServer(agents=[agent])
# Start the server
server.run(host="localhost", port=8000)