AMP Agent
A Python library for building and deploying AMP agents with ease. This library provides the functionality needed to create, manage, and run AMP agents.
Features
- Easy agent creation with base classes and interfaces
- Built-in HTTP server with Flask integration
- Token-based authentication and validation
- Configuration management
- Database integration with AsyncPG
- Async/sync support
- Logging and error handling
- Semantic interest matching
- Event subscription and listening
- Agent setup and registration utilities
- Swarm-based agent components
Modules
amp_agent: Core functionality for building and running agentsamp_setup: Configuration and setup utilitiessemantic: Semantic interest matching and processingsubscription: Event subscription and listeningswarm_cell: Swarm-based agent components
Installation
You can install the package using pip:
pip install amp-agent
For development installation:
pip install -e ".[dev]"
For testing:
pip install -e ".[test]"
For documentation:
pip install -e ".[docs]"
For machine learning features (advanced semantic matching):
pip install -e ".[ml]"
You can combine multiple extras like this:
pip install -e ".[dev,ml]"
Quick Start
Here's a simple example of creating an AMP agent:
from amp_agent import AgentInterface
from amp_agent.platform import ConfigManager
class MyAgent(AgentInterface):
async def process_message(self, content: str, metadata: dict = None) -> str:
return f"Processed: {content}"
# Setup configuration
config_manager = ConfigManager()
config = config_manager.load_config()
# Create and run server
from amp_agent.server import create_app
app = create_app()
app.run()
Development
- Clone the repository:
git clone https://github.com/theswarmhub/amp-agent.git
cd amp-agent
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies:
pip install -e ".[dev]"
- Run tests:
pytest
Configuration
Create a .env file:
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
JWT_SECRET_KEY=your-secret-key
DEBUG=True
Module Usage Examples
Core Features
from amp_agent import AgentInterface
from amp_agent.platform import ConfigManager
# Create an agent
class MyAgent(AgentInterface):
async def process_message(self, content: str, metadata: dict = None) -> str:
return f"Processed: {content}"
# Load configuration
config_manager = ConfigManager()
config = config_manager.load_config()
Semantic Processing
from amp_agent.semantic import interest
# Define interests
@interest("code_review")
async def handle_code_review(content: str) -> str:
return "Code review processed"
Event Subscription (Optional)
# Import the optional subscription module when needed
from amp_agent.subscription import AMPListener
# Create and start a listener
listener = AMPListener(config)
listener.start()
Swarm Components (Optional)
# Import the optional swarm_cell module when needed
from amp_agent.swarm_cell import SwarmCell
# Create a swarm cell
cell = SwarmCell(config)
cell.initialize()
Documentation
For detailed documentation, visit https://amp-agent.readthedocs.io/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Release files for amp-agent 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| amp_agent-0.1.4.tar.gz | 36.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amp_agent-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.5 kB
Release files / amp_agent-0.1.4.tar.gz
| Download URL | amp_agent-0.1.4.tar.gz |
|---|---|
| Size | 36.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
579fda555f2a917b60c74b29ff393f3fd08e0adbe5c7eec5c25d0d196e22046b
|
|
BLAKE2b-256 checksum How to use checksums |
7b2070d2196f5e03282cd2086b4743870bb0e0e33c3b21877f59d7aff23ee097
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / amp_agent-0.1.4-py3-none-any.whl
| Download URL | amp_agent-0.1.4-py3-none-any.whl |
|---|---|
| Size | 43.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ed52df9764e3aac97574fe6bca59c1eb74aba04a86fbf21aa1de5bfb95c5ef3
|
|
BLAKE2b-256 checksum How to use checksums |
11977b1a31cf0a84d7cb720397ce9c1e1a1c5b29334f66acb9aed1bbacdec359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|