Python SDK for AI Teammate - Build and deploy AI agents
Project description
AI Teammate Python SDK
Official Python SDK for AI Teammate - Build and deploy AI agents with ease.
Installation
pip install ai-teammate
๐ Getting Started
Step 1: ํ์๊ฐ์
- ai-teammate.net ์ ์
- Google ๋๋ Kakao๋ก ๊ฐํธ ๊ฐ์
Step 2: API ํค ๋ฐ๊ธ
- ๋ก๊ทธ์ธ ํ ์ฐ์ธก ์๋จ Settings ํด๋ฆญ
- API Keys ํญ ์ ํ
- Generate New Key ํด๋ฆญ
- ์์ฑ๋ ํค ๋ณต์ฌ (
at_xxxx...ํ์)
โ ๏ธ API ํค๋ ํ ๋ฒ๋ง ํ์๋ฉ๋๋ค. ์์ ํ ๊ณณ์ ๋ณด๊ดํ์ธ์!
Step 3: SDK ์ค์น & ์ฒซ ์์ด์ ํธ ๋ง๋ค๊ธฐ
pip install ai-teammate
from ai_teammate import AITeammate
# API ํค๋ก ํด๋ผ์ด์ธํธ ์ด๊ธฐํ
client = AITeammate(api_key="at_your_key_here")
# ์ฒซ ์์ด์ ํธ ๋ง๋ค๊ธฐ
agent = client.agents.create(
name="My First Agent",
system_prompt="You are a helpful assistant that speaks Korean.",
)
print(f"โ
์์ด์ ํธ ์์ฑ ์๋ฃ! ID: {agent.id}")
# ์์ด์ ํธ์ ๋ํ
response = client.chat("์๋
ํ์ธ์!", agent_id=agent.id)
print(f"๐ค {response.content}")
Step 4: ํฌํธ์์ ํ์ธ
SDK๋ก ์์ฑํ ์์ด์ ํธ๋ ํฌํธ ๋์๋ณด๋์์ ํ์ธํ๊ณ ๊ด๋ฆฌํ ์ ์์ต๋๋ค.
Quick Start
from ai_teammate import AITeammate
# Initialize client
client = AITeammate(api_key="at_your_api_key")
# Chat with an agent
response = client.chat("Hello!", agent_id="your_agent_id")
print(response.content)
Features
๐ค Agent Management
# List all agents
agents = client.agents.list()
# Create an agent
agent = client.agents.create(
name="My Assistant",
system_prompt="You are a helpful assistant.",
model="claude-3-sonnet",
)
# Update an agent
agent = client.agents.update(
agent_id="abc123",
name="Updated Name",
system_prompt="New prompt",
)
# Delete an agent
client.agents.delete("abc123")
๐ฌ Chat
# Simple chat
response = client.chat("What's the weather?", agent_id="abc123")
print(response.content)
# Streaming chat
for chunk in client.chat_stream("Tell me a story", agent_id="abc123"):
if chunk.type == "text":
print(chunk.content, end="", flush=True)
๐ฅ Team Chat
# Create a team
team = client.teams.create(
name="Dream Team",
chat_mode="brainstorm", # auto, round_robin, parallel, debate, brainstorm, expert
)
# Add agents to team
client.teams.add_agent(team.id, "agent_1")
client.teams.add_agent(team.id, "agent_2")
# Team chat (multi-agent discussion)
response = client.teams.chat(team.id, "Brainstorm startup ideas!")
print(response.content)
# Chat with specific mode
response = client.teams.chat(
team.id,
"Should we use microservices?",
mode="debate", # Agents debate pros and cons
)
Team Chat Modes
| Mode | Description |
|---|---|
round-robin |
Agents respond sequentially, referencing previous opinions |
parallel |
All agents respond independently |
debate |
Pro/con discussion between agents |
brainstorm |
Idea generation with voting |
expert |
Auto-selects the best agent for the question |
๐ Team API Keys
Generate API keys scoped to a team from Team Settings > API on the web portal.
# Use a team API key
client = AITeammate(api_key="at_your_team_key")
# Chat with the team
response = client.teams.chat("team_id", "Analyze this data")
print(response.content)
# List team agents
agents = client.teams.list_agents("team_id")
๐ง Memories
# Add memory to agent
memory = client.memories.create(
agent_id="abc123",
content="User prefers concise responses",
category="preferences",
)
# List memories
memories = client.memories.list(agent_id="abc123")
# Search memories
results = client.memories.search(agent_id="abc123", query="preferences")
Async Support
All methods have async versions prefixed with a:
import asyncio
async def main():
async with AITeammate(api_key="at_xxx") as client:
# Async chat
response = await client.achat("Hello!", agent_id="abc123")
# Async streaming
async for chunk in client.achat_stream("Tell me a story", agent_id="abc123"):
print(chunk.content, end="")
asyncio.run(main())
Error Handling
from ai_teammate import (
AITeammateError,
AuthenticationError,
RateLimitError,
NotFoundError,
)
try:
response = client.chat("Hello!", agent_id="invalid_id")
except NotFoundError as e:
print(f"Agent not found: {e}")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
except AuthenticationError as e:
print(f"Invalid API key: {e}")
except AITeammateError as e:
print(f"Error: {e}")
Configuration
client = AITeammate(
api_key="at_xxx",
base_url="https://ai-teammate.net/api", # Custom API URL
timeout=30.0, # Request timeout
)
API Reference
Client Methods
| Method | Description |
|---|---|
chat(message, agent_id) |
Chat with an agent |
chat_stream(message, agent_id) |
Stream chat response |
achat(message, agent_id) |
Async chat |
achat_stream(message, agent_id) |
Async stream |
Resources
| Resource | Methods |
|---|---|
agents |
list, get, create, update, delete, chat |
teams |
list, get, create, delete, add_agent, remove_agent, list_agents, chat |
memories |
list, get, create, delete, search |
License
MIT License - see LICENSE for details.
Links
- ๐ AI Teammate Platform
- ๐ API Documentation
- ๐ Issue Tracker
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_teammate-0.1.2.tar.gz.
File metadata
- Download URL: ai_teammate-0.1.2.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9157d0796ef91b11519a629025460ecf544717f13901cb3ef685930e6a610a26
|
|
| MD5 |
4ef7426926ee037f1dbe6ce5f9cd0739
|
|
| BLAKE2b-256 |
28b524d3d94aa70950924095f4c915b990dccb75e6313f64486a1eb216c20538
|
File details
Details for the file ai_teammate-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ai_teammate-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
051f7c0091f1f38787445a35a2c4b79d65808aab132cc3ca791a6abb6b79ad0d
|
|
| MD5 |
18aa47f059d856a9aaa7d76ede12248c
|
|
| BLAKE2b-256 |
3fb2cf20834d044ade6fd607b9b4f5c08481fdf480b04ca8261e1fd372d2da52
|