Metadata-Version: 2.3
Name: agentsys
Version: 0.4.0
Summary: A robust, asynchronous multi-agent development framework
Project-URL: Homepage, https://github.com/lifsys/agentsys
Project-URL: Repository, https://github.com/lifsys/agentsys.git
Project-URL: Documentation, https://github.com/lifsys/agentsys#readme
Project-URL: Issues, https://github.com/lifsys/agentsys/issues
Author: LifSys AI
License: MIT License
        
        Copyright (c) 2024 OpenAI
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
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: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: aiofiles>=23.2.1
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: asyncio>=3.4.3
Requires-Dist: numpy
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pytest-asyncio>=0.23.0
Requires-Dist: python-dotenv>=0.19.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: black>=22.0; extra == 'dev'
Requires-Dist: isort>=5.0; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# AgentSys Framework

A robust, extensible framework for building AI agents with memory, state management, and middleware capabilities.

## Features

- **Flexible Agent Architecture**
  - BaseAgent: Core functionality and lifecycle management
  - TaskAgent: Task-specific agent implementation base
  - Memory System: Both working and long-term storage
  - State Management: Full agent lifecycle control

- **Extensible Components**
  - Middleware: Caching, retries, and telemetry
  - Plugins: Routing and storage backends
  - Protocols: Messaging and streaming support
  - Configuration: Flexible settings management

- **Built-in Memory Management**
  - Working Memory: Fast, in-memory storage
  - Long-term Memory: Persistent storage with JSON serialization
  - Memory Manager: Unified memory interface

## Documentation

- [**Core API**](docs/api.md): Comprehensive guide to BaseAgent, TaskAgent, and the memory system. Learn how to create custom agents and manage state.
- [**Middleware**](docs/middleware.md): Cache responses, implement retries, and monitor performance with the middleware system.
- [**Plugins**](docs/plugins.md): Extend functionality with routing and storage plugins. Build custom plugins for your specific needs.
- [**Protocols**](docs/protocols.md): Implement inter-agent communication and real-time data streaming with the protocol system.

## Installation

```bash
pip install agentsys
```

## Quick Start

```python
from agentsys.core import TaskAgent
from typing import Any

class MyAgent(TaskAgent):
    async def _run_task(self, input_data: Any) -> Any:
        # Implement your agent's logic here
        return processed_result

# Create and use your agent
agent = MyAgent(
    name="MyAgent",
    description="A custom agent",
    task_description="Process specific tasks"
)

result = await agent.execute(input_data)
```

## Framework Components

### Core (agentsys.core)

- **BaseAgent**: Foundation class with lifecycle management
- **TaskAgent**: Base class for task-specific agents
- **Memory System**: Working and long-term memory management

### Middleware (agentsys.middleware)

- **Cache**: Response caching for performance
- **Retry**: Automatic retry logic
- **Telemetry**: Performance monitoring

### Plugins (agentsys.plugins)

- **Router**: Agent communication and task routing
- **Storage**: Custom storage backends

### Protocols (agentsys.protocols)

- **Messaging**: Inter-agent communication
- **Streaming**: Real-time data handling

## Example Implementations

Check the `examples/` directory for various agent implementations:

- **ChatAgent**: OpenAI-powered chat agent
- **More examples coming soon**

## Building Custom Agents

1. **Inherit from TaskAgent**:
```python
class CustomAgent(TaskAgent):
    async def _run_task(self, input_data: Any) -> Any:
        # Your implementation here
        pass
```

2. **Use Memory**:
```python
# Store in working memory
await self.memory.working_memory.store("key", value)

# Store in long-term memory
if self.memory.long_term_memory:
    await self.memory.long_term_memory.store("key", value)
```

3. **Handle State**:
```python
# State is automatically managed in execute()
try:
    self.state = AgentState.RUNNING
    result = await self._run_task(input_data)
    self.state = AgentState.COMPLETED
    return result
except Exception as e:
    self.state = AgentState.ERROR
    raise e
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## License

MIT License - see LICENSE file for details
