No description
Find a file
2025-12-01 14:57:53 -05:00
.docker feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
ci feat: Added context tracking when using via run, and added context command for managing it 2025-11-06 19:19:18 -05:00
docs feat: Added context tracking when using via run, and added context command for managing it 2025-11-06 19:19:18 -05:00
examples Feat: Successfully gets through content running section 2025-12-01 14:57:53 -05:00
src/cleveragents Fix: Content writing stages werent working due to JINJA2 template not applying correctly 2025-11-25 19:31:33 -05:00
tests Chore: RxPy routing is not garunteed to work in run mode so added some guardrails to prevent that. 2025-11-21 14:48:46 -05:00
.bumpversion.cfg feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
.cookiecutterrc Added boilerplate code for python 2024-03-06 23:57:14 -05:00
.coveragerc chore: update .coveragerc to exclude tests from coverage source 2025-07-05 23:12:53 -04:00
.cz-config.js Initial commit 2024-01-25 23:10:04 -05:00
.cz.json Initial commit 2024-01-25 23:10:04 -05:00
.editorconfig Initial commit 2024-01-25 23:10:04 -05:00
.gitattributes Initial commit 2024-01-25 23:10:04 -05:00
.gitignore fix: Fixed many of the remaining issues and got a mostly working integration test for scientific paper writer 2025-11-11 12:34:49 -05:00
.python-version Updated to latest python versions 2025-04-20 22:21:51 -04:00
ATTRIBUTIONS.rst feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
CHANGELOG.rst feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
CODE_OF_CONDUCT.rst feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
CONTRIBUTING.rst feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
CONTRIBUTORS.rst feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
docker-compose.yml feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
Dockerfile feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
Dockerfile.dev feat: migrate project to CleverAgents with new features and tests 2025-06-28 14:49:24 -04:00
LICENSE Added Apache OSS license 2024-01-25 23:14:00 -05:00
MANIFEST.in feat: Added context tracking when using via run, and added context command for managing it 2025-11-06 19:19:18 -05:00
NOTICE Added Apache OSS license 2024-01-25 23:14:00 -05:00
pyproject.toml Fixed linting and typechecking, tox fully works now 2025-11-15 23:40:59 -05:00
README.md test: update bdd test cases; docs: update readme and yaml syntax docs 2025-10-24 23:14:26 +05:30
README.rst Feat: LangChain now acts as LLM provider increasing availible LLMs supported 2025-08-04 03:48:13 +00:00
sample_contract.txt fix: thread safety AgentWithMemory and improve ToolAgent JSON parsing and mypy issues 2025-10-10 19:38:52 +05:30
setup.cfg Chore: Moved any pytest tests over to behave and removed pytest entierly 2025-11-18 17:32:04 -05:00
setup.py Fixed linting and typechecking, tox fully works now 2025-11-15 23:40:59 -05:00
tox.ini Added Robot Framework for integration testing and a simple starting integration test 2025-11-07 12:38:19 -05:00

CleverAgents

A powerful, reactive Agent Framework using RxPy streams for complex AI agent orchestration and message routing.

🌊 What is CleverAgents?

CleverAgents is a reactive agent orchestration framework that combines the power of RxPy reactive streams with LangGraph stateful workflows to create sophisticated AI agent networks. It's designed for building complex, multi-agent systems that can handle real-time data processing, conversational AI, and workflow automation.

Key Features

  • 🌊 Reactive Architecture: Built on RxPy streams for real-time data processing
  • 🤖 Multiple Agent Types: LLM agents, tool agents, composite agents, and more
  • 🔄 Unified Routes: Single configuration system for streams and graphs
  • 🧠 Memory Management: Conversation history and state persistence
  • 🔗 LangGraph Integration: Stateful workflows with conditional logic
  • Async Processing: Full async/await support throughout
  • 🎯 Template System: Reusable agent and workflow templates

📦 Installation

Prerequisites

  • Python 3.9+ (recommended: Python 3.11+)
  • pip package manager

For development (editable install):

git clone https://git.cleverthis.com/cleveragents/cleveragents-core
cd cleveragents-core
pip install -e .

Dependencies

CleverAgents automatically installs these dependencies:

  • click - Command-line interface
  • rx>=3.2.0 - Reactive extensions for Python
  • jinja2 - Template engine
  • pystache - Mustache template support
  • pyyaml - YAML configuration parsing
  • langchain-core>=0.3.0 - LangChain integration
  • langchain-openai>=0.2.0 - OpenAI integration
  • langchain-anthropic>=0.2.0 - Anthropic integration
  • langchain-google-genai>=2.0.0 - Google Gemini integration
  • aiohttp - Async HTTP client

🚀 Quick Start

1. Create a Configuration File

Create a config.yaml file:

agents:
  chat_agent:
    type: llm
    config:
      provider: openai
      model: gpt-4
      temperature: 0.7
      memory_enabled: true

routes:
  chat_stream:
    type: stream
    stream_type: cold
    operators:
      - type: map
        params:
          agent: chat_agent
    publications:
      - __output__

merges:
  - sources: [__input__]
    target: chat_stream

2. Set Up API Keys

Configure your API keys via environment variables:

export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export GOOGLE_API_KEY="your-google-key"

Or include them directly in your configuration:

agents:
  chat_agent:
    type: llm
    config:
      provider: openai
      model: gpt-4
      api_key: "your-openai-key"

3. Run CleverAgents

Interactive Mode:

cleveragents interactive -c config.yaml

Single-Shot Mode:

cleveragents run -c config.yaml -p "Hello, how are you?"

🛠️ Command Line Interface

Main Commands

cleveragents run

Process a single prompt through the agent network.

cleveragents run -c config.yaml -p "Your prompt here"

Options:

  • -c, --config: Path to configuration file(s) (can be used multiple times)
  • -p, --prompt: The prompt to send to the agent network
  • -o, --output: Optional file to write output to
  • -v, --verbose: Enable verbose output
  • -u, --unsafe: Enable unsafe mode for code execution

cleveragents interactive

Start an interactive chat session.

cleveragents interactive -c config.yaml

Options:

  • -c, --config: Path to configuration file(s)
  • -h, --history: Optional file to load/save conversation history
  • -v, --verbose: Enable verbose output
  • -u, --unsafe: Enable unsafe mode

cleveragents generate-examples

Generate example configuration files.

cleveragents generate-examples -o ./my-examples

Options:

  • -o, --output: Directory to write example files to (default: ./examples)

cleveragents visualize

Visualize the agent network.

cleveragents visualize -c config.yaml -f mermaid

Options:

  • -c, --config: Path to configuration file(s)
  • -o, --output: Output file for the diagram
  • -f, --format: Output format (mermaid, dot, ascii)

Interactive Session Commands

When in interactive mode, you can use these commands:

  • exit - Exit the session
  • help - Show available commands
  • /stream <name> <message> - Send message to specific stream
  • /graph <name> <message> - Execute a LangGraph with message

🔧 API Key Configuration

CleverAgents supports multiple LLM providers through LangChain. Configure API keys in two ways:

# OpenAI
export OPENAI_API_KEY="sk-your-key-here"

# Anthropic
export ANTHROPIC_API_KEY="your-anthropic-key"

# Google Gemini
export GOOGLE_API_KEY="your-google-key"

Supported Models

OpenAI:

  • GPT-4, GPT-4o, GPT-3.5-turbo
  • o1-preview, o1-mini

Anthropic:

  • Claude-3.5-Sonnet, Claude-3-Opus, Claude-3-Haiku

Google:

  • Gemini-1.5-Pro, Gemini-1.5-Flash, Gemini-2.0-Flash

🏗️ Architecture

Reactive Streams (RxPy)

CleverAgents uses RxPy for reactive programming:

  • Hot Streams: Always active, replay last value
  • Cold Streams: Start when subscribed
  • Replay Streams: Replay all previous values
  • Operators: map, filter, merge, split, buffer, throttle, debounce

Agent Types

  1. LLM Agents: Powered by large language models
  2. Tool Agents: Execute functions and tools
  3. Composite Agents: Combine multiple agents
  4. Chain Agents: Sequential processing chains

Unified Routes System

Single configuration system for different processing types:

  • Stream Routes: Reactive, stateless processing
  • Graph Routes: Stateful workflows with conditional logic
  • Bridge Routes: Dynamic type conversion

📚 Examples

Basic Chat

cleveragents interactive -c examples/basic_chat.yaml

Scientific Paper Writer

cleveragents interactive -c examples/scientific_paper_writer.yaml

Multi-Agent Collaboration

cleveragents interactive -c examples/collaboration_reactive.yaml

🧪 Development

Running Tests

# Run all BDD tests
pip install behave
python -m behave tests/features

# Run with coverage
coverage run -m behave tests/features
coverage report
coverage html

# Run with tox for multiple environments
tox

# Run specific Python version
tox -e py39
tox -e py312

# Run tests with coverage
tox -e py312-cover

# Run without coverage (faster)
tox -e py312-nocov

# Integration test scripts (all tests passing):
bash tests/scripts/test_multi_agent_paper_writer_langgraph.sh      # Multi-agent paper writing with LangGraph
bash tests/scripts/test_legal_contract_analyzer_langgraph.sh       # Legal contract analysis with LangGraph
bash tests/scripts/test_paper_writer_section_by_section.sh         # Section-by-section paper writing

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

📄 License

Apache License 2.0

🤝 Support

For questions, issues, or contributions, please visit our GitHub repository or contact us at dev@cleverthis.com.