Skip to main content

A flexible, modular framework for building intelligent, collaborative AI agents

Project description

ArtCafe.ai Agent Framework

ArtCafe.ai Logo

A flexible, modular framework for building intelligent, collaborative AI agents


Overview

The Agent Framework is a key component of the ArtCafe.ai platform, providing the foundation for building intelligent agents that can:

  • Communicate through a pub/sub messaging system
  • Discover and collaborate with other agents
  • Process complex data and make decisions
  • Self-report status and health metrics
  • Manage their own lifecycle (start, stop, pause, etc.)

The framework implements a clean, extensible architecture with well-defined interfaces and pluggable components, making it easy to customize and extend.

Key Features

🚀 New: Simplified Agent Creation

  • SimpleAgent: Get started with just 3 lines of code
  • AugmentedLLMAgent: Start with LLM capabilities, add tools as needed
  • VerifiedAgent: Built-in verification and ground truth checks
  • BudgetAwareAgent: Cost tracking and budget enforcement

Core Features

  • Lightweight Agent Core: Base agent classes with essential functionality
  • Flexible Messaging: Multiple messaging backends (memory, pub/sub, NATS)
  • NATS Integration: Scalable pub/sub architecture with hierarchical topics
  • LLM Integration: Plug-and-play support for leading LLM providers
  • Tool Framework: Decorator-based tool creation and registry
  • Workflow Patterns: Pre-built patterns for chaining, routing, and parallelization
  • Event Loop Architecture: Structured flow for agent-LLM interactions
  • Conversation Management: Context window management for LLM interactions
  • MCP Support: Integration with Model Context Protocol servers (including MCP over NATS)
  • A2A Protocol: Agent-to-Agent negotiation and coordination
  • Telemetry & Tracing: Built-in metrics collection and tracing

Installation

# Install from PyPI (coming soon)
pip install artcafe-agent-framework

# Install from source
git clone https://github.com/artcafeai/agent-framework.git
cd agent-framework
pip install -e .

# Or install with optional dependencies
pip install -e ".[llm-providers,dev]"

Quick Start

Hello World Example

The absolute simplest way to create an agent:

from framework import create_agent

# Create and run an agent in 3 lines
agent = create_agent("my-agent")

@agent.on_message("hello")
def say_hello(message):
    return {"response": f"Hello, {message.get('name', 'World')}!"}

agent.run()

LLM-First Example

Start with an LLM and add capabilities:

from framework import create_llm_agent

# Create an LLM agent with tools
agent = create_llm_agent(provider="anthropic", api_key="your-key")

@agent.tool
def search_web(query: str) -> str:
    """Search the web for information."""
    # Your search implementation
    return f"Search results for: {query}"

# Chat with the agent
response = await agent.chat("What's the weather in Paris?")
print(response)

Verified Agent Example

Build reliable agents with verification:

from framework import VerifiedAgent, verify_input, verify_output

class DataAgent(VerifiedAgent):
    @verify_input(lambda x: "data" in x)
    @verify_output(lambda x: x is not None)
    async def process_data(self, message):
        # Process with automatic verification
        return {"processed": message["data"].upper()}

Architecture

The ArtCafe.ai Agent Framework is built on a modular architecture with these key components:

Core Components

  • BaseAgent: Abstract base class that defines the agent lifecycle and messaging patterns
  • EnhancedAgent: Extension with integrated messaging, configuration, and advanced features
  • MessagingInterface: Abstraction layer for all messaging operations
  • Provider Pattern: Support for different messaging backends (in-memory, pub/sub)
  • LLM Integration: Pluggable LLM providers (Anthropic, OpenAI, Bedrock)

Directory Structure

/agent_framework/
├── agents/                 # Agent implementations
├── framework/              # Core framework code
│   ├── auth/               # Authentication providers
│   ├── conversation/       # Conversation management
│   ├── core/               # Base agent classes
│   ├── event_loop/         # Event loop architecture
│   ├── examples/           # Example agent implementations
│   ├── llm/                # LLM provider implementations
│   ├── mcp/                # Model Context Protocol
│   ├── messaging/          # Messaging providers
│   ├── telemetry/          # Metrics and tracing
│   └── tools/              # Tool decorator and registry
├── main.py                 # Main entry point
└── setup_agent.py          # Setup script

NATS Integration

The framework now supports NATS as a scalable messaging backbone:

from framework.core import NATSAgent, AgentConfig

# Create a NATS-enabled agent
config = AgentConfig({"nats.servers": ["nats://localhost:4222"]})
agent = NATSAgent(agent_id="my-agent", config=config)

# Use MCP over NATS
await agent.call_mcp_tool("remote-server", "search", {"query": "AI news"})

# A2A negotiations
result = await agent.negotiate_with_agents(
    ["agent-2", "agent-3"],
    "task_assignment",
    {"task": "process_data", "size": "10GB"}
)

See the NATS Integration Guide for details.

Advanced Topics

For more advanced usage, check out the example scripts in the examples/ directory. These demonstrate:

  • Building multi-agent systems with NATS
  • Using MCP over NATS and A2A protocols
  • Customizing LLM providers
  • Creating tool libraries
  • Implementing custom messaging backends
  • Integrating with external services

Contributing

We welcome contributions to the Agent Framework! Please see the Contributing Guide for details on how to get involved.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About ArtCafe.ai

ArtCafe.ai is building the future of AI collaboration by providing tools, frameworks, and infrastructure for creating and deploying intelligent agent systems. Our mission is to make AI agents accessible, composable, and useful for real-world tasks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

artcafe_agent_framework-0.4.0.tar.gz (105.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artcafe_agent_framework-0.4.0-py3-none-any.whl (134.0 kB view details)

Uploaded Python 3

File details

Details for the file artcafe_agent_framework-0.4.0.tar.gz.

File metadata

  • Download URL: artcafe_agent_framework-0.4.0.tar.gz
  • Upload date:
  • Size: 105.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for artcafe_agent_framework-0.4.0.tar.gz
Algorithm Hash digest
SHA256 218e8f3a079ab14a189576e9a186a85e2959466f249a8ca08a6a73af41079cb1
MD5 259f075df8559b5349bdf154c33160ad
BLAKE2b-256 7e95c17a7d9209cbb51f17891e18ce7bc5beaa53bc573698164751fdb401120f

See more details on using hashes here.

Provenance

The following attestation bundles were made for artcafe_agent_framework-0.4.0.tar.gz:

Publisher: publish-to-pypi.yml on ArtCafeAI/ArtCafeAI-Agent-Framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file artcafe_agent_framework-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for artcafe_agent_framework-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6f9d3db3745695c49a57e3768172fed6bfcd8aeed4807f0b97de97f66228bc
MD5 77fc3771beaf7ff03495ed69244618bb
BLAKE2b-256 a92e479dafb8e5dac51c9fd90131d85c8251068b183c471d6494489c0099bb6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for artcafe_agent_framework-0.4.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on ArtCafeAI/ArtCafeAI-Agent-Framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page