Metadata-Version: 2.4
Name: agent1
Version: 0.1.17
Summary: A simple LLM abstraction layer
Project-URL: Homepage, https://github.com/vincentdeneuf/agent1
Project-URL: Repository, https://github.com/vincentdeneuf/agent1
Project-URL: Issues, https://github.com/vincentdeneuf/agent1/issues
Author-email: vincentdeneuf <0189vn@gmail.com>
License: MIT
License-File: LICENSE
Keywords: abstraction,ai,anthropic,llm,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: litellm>=1.81.12
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.3
Description-Content-Type: text/markdown

# agent1

A simple LLM abstraction layer for Python applications.

## Features

- **Unified API**: Single interface for multiple LLM providers (OpenAI, Anthropic, etc.)
- **Flexible Content Types**: Support for text, images, audio, and file inputs
- **Message Abstraction**: Unified message handling across different API types

## Installation

```bash
pip install agent1
```

## Quick Start

```python
from agent1 import Message, Agent

# 1. Create a Message
message = Message(
    content="What is the capital of France?",
    role="user"
)

# 2. Create an Agent
agent = Agent(
    instruction="You are a helpful assistant.",
    model="gpt-4"
)

# 3. Load an Agent from config file
# agent = Agent.load("config/agent.toml")

# 4. Do work (synchronous)
response = agent.work([message])
print(response.content)

# 5. Stream responses
for chunk in agent.stream([message]):
    if hasattr(chunk, 'content'):
        print(chunk.content, end='', flush=True)
```

## Advanced

### Loading Agent from Config File

Create a config file (supports .toml, .json, .yaml, .yml):

```toml
# agent.toml
instruction = "You are a helpful assistant that specializes in Python programming."
model = "gpt-4"
temperature = 0.7
```

Load and use the agent:

```python
from agent1 import Agent, Message

# Load agent from config file
agent = Agent.load("agent.toml")

message = Message(
    content="How do I create a list comprehension in Python?",
    role="user"
)

response = agent.work([message])
print(response.content)
```

### Async Methods

For non-blocking operations, use async methods:

```python
import asyncio
from agent1 import Agent, Message

async def main():
    agent = Agent(
        instruction="You are a helpful assistant.",
        model="gpt-4"
    )
    
    message = Message(
        content="Explain quantum computing in simple terms.",
        role="user"
    )
    
    # Async work
    response = await agent.work_async([message])
    print(response.content)
    
    # Async streaming
    async for chunk in agent.stream_async([message]):
        if hasattr(chunk, 'content'):
            print(chunk.content, end='', flush=True)

# Run the async function
asyncio.run(main())
```
