2025-08-01 06:00:25 +08:00
|
|
|
# Kortix SDK
|
|
|
|
|
|
|
|
[](https://python.org)
|
|
|
|
|
2025-08-09 09:23:08 +08:00
|
|
|
A Python SDK that enables you to create, manage, and interact with AI Workers on [Suna](https://suna.so).
|
2025-08-01 06:00:25 +08:00
|
|
|
|
|
|
|
## 📦 Installation
|
|
|
|
|
|
|
|
Install directly from the GitHub repository:
|
|
|
|
|
|
|
|
```bash
|
2025-08-01 22:42:35 +08:00
|
|
|
pip install "kortix @ git+https://github.com/kortix-ai/suna.git@main#subdirectory=sdk"
|
2025-08-01 06:00:25 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
Or using uv:
|
|
|
|
|
|
|
|
```bash
|
2025-08-01 22:42:35 +08:00
|
|
|
uv add "kortix @ git+https://github.com/kortix-ai/suna.git@main#subdirectory=sdk"
|
2025-08-01 06:00:25 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
## 🔧 Quick Start
|
|
|
|
|
|
|
|
```python
|
|
|
|
import asyncio
|
|
|
|
from kortix import kortix
|
|
|
|
|
|
|
|
async def main():
|
|
|
|
mcp_tools = kortix.MCPTools(
|
|
|
|
"http://localhost:4000/mcp/", # Point to any HTTP MCP server
|
|
|
|
"Kortix",
|
|
|
|
)
|
|
|
|
await mcp_tools.initialize()
|
|
|
|
|
|
|
|
# Initialize the client
|
|
|
|
client = kortix.Kortix(api_key="your-api-key")
|
|
|
|
|
|
|
|
# Create an agent
|
|
|
|
agent = await client.Agent.create(
|
|
|
|
name="My Assistant",
|
|
|
|
system_prompt="You are a helpful AI assistant.",
|
|
|
|
mcp_tools=[mcp_tools],
|
|
|
|
allowed_tools=["get_wind_direction"],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Create a conversation thread
|
|
|
|
thread = await client.Thread.create()
|
|
|
|
|
|
|
|
# Run the agent
|
|
|
|
run = await agent.run("Hello, how are you?", thread)
|
|
|
|
|
|
|
|
# Stream the response
|
|
|
|
stream = await run.get_stream()
|
|
|
|
async for chunk in stream:
|
|
|
|
print(chunk, end="")
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
asyncio.run(main())
|
|
|
|
```
|
|
|
|
|
|
|
|
## 🔑 Environment Setup
|
|
|
|
|
|
|
|
Get your API key from [https://suna.so/settings/api-keys](https://suna.so/settings/api-keys)
|
|
|
|
|
|
|
|
## 🧪 Running Examples
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Install dependencies
|
|
|
|
uv sync
|
|
|
|
|
|
|
|
# Run the main example
|
|
|
|
PYTHONPATH=$(pwd) uv run example/example.py
|
|
|
|
```
|