Metadata-Version: 2.4
Name: sypho-sdk
Version: 0.3.15
Summary: Python SDK for building and deploying Sypho agents
Author-email: Sypho <hello@sypho.ai>
License: MIT
Project-URL: Homepage, https://sypho.ai
Project-URL: Documentation, https://docs.sypho.ai
Project-URL: Repository, https://github.com/sypho/sypho-sdk
Keywords: agent,ai,automation,sdk,sypho
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: click>=8.3.1
Requires-Dist: langchain>=1.2.13
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: requests>=2.32.5
Requires-Dist: mcp>=1.12.0
Requires-Dist: python-socketio[asyncio-client]>=5.11.0
Requires-Dist: patchright>=1.40.0
Requires-Dist: pyvirtualdisplay>=3.0
Requires-Dist: httpx>=0.27.0

# Sypho SDK

Python SDK for building and deploying AI agents on the Sypho platform.

## Installation

```bash
pip install sypho-sdk
```

## Quick Start

### 1. Define an Agent with Entrypoints

```python
from sypho_sdk import entrypoint, tool, AgentContext

@entrypoint(name="search", description="Search for information")
async def search_handler(input: dict, context: AgentContext):
    query = input["query"]

    # Call tools
    results = await context.call_tool("web_search", {"query": query})

    return {"results": results}

@tool(name="web_search", description="Search the web")
def web_search(query: str) -> dict:
    # Your search implementation
    return {"results": [...]}
```

### 2. Auto-Discovery

The SDK automatically discovers all `@entrypoint` and `@tool` decorated functions when packaging your agent:

```bash
python -m sypho_sdk.auto_package my_agent.main my-agent 0.1.0
```

This generates a complete manifest with all entrypoints and tools automatically discovered.

### 3. Local Development

```python
from sypho_sdk import Agent

# Traditional agent definition (also supported)
agent = Agent("my-agent")

@agent.task
async def run(input: dict, context):
    # Agent logic
    return {"output": "result"}
```

## Features

- **@entrypoint decorator**: Mark functions as agent entry points
- **@tool decorator**: Define reusable tools with automatic schema generation
- **Auto-discovery**: Automatically generate manifests from decorated functions
- **Agent Context**: Built-in context for tool calls, LLM interactions, and state management
- **Local tools**: Mark tools as local with `@tool(local=True)`
- **Type hints**: Automatic parameter schema generation from Python type hints

## API Reference

### Decorators

#### `@entrypoint(name=None, description=None)`

Marks a function as an agent entrypoint. Entrypoints are the main execution paths for your agent.

```python
@entrypoint(name="main", description="Main entry point")
async def main_handler(input: dict, context: AgentContext):
    return {"result": "success"}
```

#### `@tool(name=None, description=None, parameters=None, local=False)`

Defines a tool that can be called by the agent.

```python
@tool(name="calculate", description="Perform calculations")
def calculate(a: int, b: int, operation: str = "add") -> int:
    if operation == "add":
        return a + b
    elif operation == "multiply":
        return a * b
```

### Classes

#### `AgentContext`

Provides methods for interacting with the platform during agent execution:

- `await context.call_tool(name, args)`: Call a tool
- `await context.chat(messages, tools)`: Interact with LLM
- `context.run_loop()`: Start agentic execution loop

#### `Agent`

Traditional agent definition class (backwards compatible):

```python
agent = Agent("agent-name")

@agent.task
async def run(input, context):
    return {"output": "result"}
```

## Examples

### Multi-Entrypoint Agent

```python
from sypho_sdk import entrypoint, tool, AgentContext

@entrypoint(name="analyze", description="Analyze data")
async def analyze(input: dict, context: AgentContext):
    data = input["data"]
    analysis = await context.call_tool("process_data", {"data": data})
    return {"analysis": analysis}

@entrypoint(name="report", description="Generate report")
async def report(input: dict, context: AgentContext):
    analysis_result = input["analysis_result"]
    report = await context.call_tool("format_report", analysis_result)
    return {"report": report}

@tool(name="process_data")
def process_data(data: list) -> dict:
    return {"processed": len(data)}

@tool(name="format_report")
def format_report(data: dict) -> str:
    return f"Analysis Report: {data}"
```

## Development

### Building the Package

```bash
python -m build
```

### Installing Locally

```bash
pip install -e .
```

## License

MIT

## Support

- Documentation: https://docs.sypho.ai
- GitHub: https://github.com/sypho/sypho-sdk
- Website: https://sypho.ai
