robotape


Namerobotape JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/andrewlwn77/robotape
SummaryA lightweight agent framework
upload_time2025-01-06 06:22:16
maintainerNone
docs_urlNone
authorAndrew Lewin
requires_python>=3.9
licenseMIT
keywords agent framework autonomous ai
VCS
bugtrack_url
requirements pydantic sqlmodel sqlalchemy python-dotenv asyncio aiohttp typing-extensions uuid mirascope mirascope mirascope mcp openai anthropic huggingface-hub
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Lightweight Agent Framework

<p align="center">
  <img src="https://raw.githubusercontent.com/andrewlwn77/robotape/refs/heads/main/docs/lightagent.jpg" alt="Lightweight Agent Framework Logo" width="400"/>
</p>

A minimalist, extensible framework for building autonomous agents with a focus on transparency and composability.

## Overview

Lightweight Agent Framework (LAF) provides a simple yet powerful foundation for building autonomous agents that can think, act, and observe within a structured environment. With LAF, you can:

- Create agents that follow a clear think-act-observe cycle
- Record and replay agent interactions using the tape system
- Build complex workflows by composing multiple agents
- Persist and analyze agent execution history
- Extend functionality through a modular tool system
- Integrate with external tools and services using the **Model Control Protocol (MCP)**

## Key Features

- ๐ŸŽฏ **Simple Core Concepts**: Based on three fundamental operations - think, act, and observe
- ๐Ÿ“ผ **Tape-Based History**: Record every step of your agent's execution for analysis and debugging
- ๐Ÿ›  **Modular Tools**: Easily extend agent capabilities through a flexible tool system
- ๐Ÿ’พ **Built-in Storage**: Persist agent history with built-in SQLite support (expandable to other backends)
- ๐Ÿ”„ **Async Support**: Built with asyncio for efficient concurrent operations
- ๐Ÿงช **Testing Ready**: Comprehensive testing utilities and fixtures included
- ๐Ÿค– **MCP Integration**: Seamlessly integrate with external tools and services using the Model Control Protocol

## Quick Installation

```bash
pip install robotape
```

For development installation:

```bash
pip install robotape[dev]
```

---

## Basic Usage

Here's a simple example of creating and running an agent:

```python
from robotape.agents import SimpleAgent
from robotape.tape import Tape, StepType

# Create an agent and a tape
agent = SimpleAgent("my_agent")
tape = Tape()

# Add an initial thought
tape.append(Step(
    type=StepType.THOUGHT,
    content="I should search for information",
    metadata=StepMetadata(agent="my_agent", node="planning")
))

# Execute the agent
await agent.execute_step(tape.get_last_step())
```

---

## Using MCPLLMAgent

The `MCPLLMAgent` is a specialized agent that combines the capabilities of LLMs with the **Model Control Protocol (MCP)**. It allows agents to interact with external tools and services through an MCP server, enabling more complex workflows and integrations.

### Example: Using MCPLLMAgent

```python
from robotape.agents.mcpllm import MCPLLMAgent
from robotape.llm import LLMConfig

# Configure the LLM
llm_config = LLMConfig(
    model="gpt-4",
    api_key="your-api-key",
    provider_name="openai"
)

# Configure the MCP server
mcp_config = {
    "command": "python",
    "args": ["path/to/mcp_server.py"],
    "env": {"ENV_VAR": "value"}
}

# Create an MCPLLMAgent
agent = MCPLLMAgent("mcp_agent", llm_config, mcp_config)

# Connect to the MCP server
await agent.connect()

# Execute a full think-act-observe cycle
context = {"task": "Analyze test data"}
thought_result = await agent.think(context)
action_result = await agent.act(thought_result)
observe_result = await agent.observe(action_result)
```

---

## Advanced Features

- **Custom Agents**: Extend `BaseAgent` to create specialized agents
- **Tool Integration**: Add new capabilities through the tool system
- **Storage Backends**: Built-in SQLite support, extensible to other databases
- **Tape Management**: Clone, branch, and analyze execution history
- **Validation**: Built-in parameter validation and error handling
- **MCP Integration**: Connect to external tools and services using the Model Control Protocol

---

## Documentation

For detailed information, check out:

- [Getting Started Guide](docs/getting_started.md)
- [Tape System Documentation](docs/tape_system.md)
- [Agent System Guide](docs/agents.md)

---

## Development

Clone and set up the development environment:

```bash
git clone https://github.com/andrewlwn77/robotape.git
cd robotape
pip install -e ".[dev]"
```

Run tests:

```bash
pytest tests/ --cov=robotape
```

---

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/andrewlwn77/robotape",
    "name": "robotape",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "agent, framework, autonomous, AI",
    "author": "Andrew Lewin",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4f/2c/9dc162397746e339a5ac40b2909a60a98657c6c4cf7d953cd8434b201871/robotape-0.2.0.tar.gz",
    "platform": null,
    "description": "# Lightweight Agent Framework\n\n<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/andrewlwn77/robotape/refs/heads/main/docs/lightagent.jpg\" alt=\"Lightweight Agent Framework Logo\" width=\"400\"/>\n</p>\n\nA minimalist, extensible framework for building autonomous agents with a focus on transparency and composability.\n\n## Overview\n\nLightweight Agent Framework (LAF) provides a simple yet powerful foundation for building autonomous agents that can think, act, and observe within a structured environment. With LAF, you can:\n\n- Create agents that follow a clear think-act-observe cycle\n- Record and replay agent interactions using the tape system\n- Build complex workflows by composing multiple agents\n- Persist and analyze agent execution history\n- Extend functionality through a modular tool system\n- Integrate with external tools and services using the **Model Control Protocol (MCP)**\n\n## Key Features\n\n- \ud83c\udfaf **Simple Core Concepts**: Based on three fundamental operations - think, act, and observe\n- \ud83d\udcfc **Tape-Based History**: Record every step of your agent's execution for analysis and debugging\n- \ud83d\udee0 **Modular Tools**: Easily extend agent capabilities through a flexible tool system\n- \ud83d\udcbe **Built-in Storage**: Persist agent history with built-in SQLite support (expandable to other backends)\n- \ud83d\udd04 **Async Support**: Built with asyncio for efficient concurrent operations\n- \ud83e\uddea **Testing Ready**: Comprehensive testing utilities and fixtures included\n- \ud83e\udd16 **MCP Integration**: Seamlessly integrate with external tools and services using the Model Control Protocol\n\n## Quick Installation\n\n```bash\npip install robotape\n```\n\nFor development installation:\n\n```bash\npip install robotape[dev]\n```\n\n---\n\n## Basic Usage\n\nHere's a simple example of creating and running an agent:\n\n```python\nfrom robotape.agents import SimpleAgent\nfrom robotape.tape import Tape, StepType\n\n# Create an agent and a tape\nagent = SimpleAgent(\"my_agent\")\ntape = Tape()\n\n# Add an initial thought\ntape.append(Step(\n    type=StepType.THOUGHT,\n    content=\"I should search for information\",\n    metadata=StepMetadata(agent=\"my_agent\", node=\"planning\")\n))\n\n# Execute the agent\nawait agent.execute_step(tape.get_last_step())\n```\n\n---\n\n## Using MCPLLMAgent\n\nThe `MCPLLMAgent` is a specialized agent that combines the capabilities of LLMs with the **Model Control Protocol (MCP)**. It allows agents to interact with external tools and services through an MCP server, enabling more complex workflows and integrations.\n\n### Example: Using MCPLLMAgent\n\n```python\nfrom robotape.agents.mcpllm import MCPLLMAgent\nfrom robotape.llm import LLMConfig\n\n# Configure the LLM\nllm_config = LLMConfig(\n    model=\"gpt-4\",\n    api_key=\"your-api-key\",\n    provider_name=\"openai\"\n)\n\n# Configure the MCP server\nmcp_config = {\n    \"command\": \"python\",\n    \"args\": [\"path/to/mcp_server.py\"],\n    \"env\": {\"ENV_VAR\": \"value\"}\n}\n\n# Create an MCPLLMAgent\nagent = MCPLLMAgent(\"mcp_agent\", llm_config, mcp_config)\n\n# Connect to the MCP server\nawait agent.connect()\n\n# Execute a full think-act-observe cycle\ncontext = {\"task\": \"Analyze test data\"}\nthought_result = await agent.think(context)\naction_result = await agent.act(thought_result)\nobserve_result = await agent.observe(action_result)\n```\n\n---\n\n## Advanced Features\n\n- **Custom Agents**: Extend `BaseAgent` to create specialized agents\n- **Tool Integration**: Add new capabilities through the tool system\n- **Storage Backends**: Built-in SQLite support, extensible to other databases\n- **Tape Management**: Clone, branch, and analyze execution history\n- **Validation**: Built-in parameter validation and error handling\n- **MCP Integration**: Connect to external tools and services using the Model Control Protocol\n\n---\n\n## Documentation\n\nFor detailed information, check out:\n\n- [Getting Started Guide](docs/getting_started.md)\n- [Tape System Documentation](docs/tape_system.md)\n- [Agent System Guide](docs/agents.md)\n\n---\n\n## Development\n\nClone and set up the development environment:\n\n```bash\ngit clone https://github.com/andrewlwn77/robotape.git\ncd robotape\npip install -e \".[dev]\"\n```\n\nRun tests:\n\n```bash\npytest tests/ --cov=robotape\n```\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight agent framework",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://github.com/andrewlwn77/robotape/tree/main/docs",
        "Homepage": "https://github.com/andrewlwn77/robotape",
        "Repository": "https://github.com/andrewlwn77/robotape"
    },
    "split_keywords": [
        "agent",
        " framework",
        " autonomous",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91bc0e21cf52be6976d68d1223fb857340b9c43e69676ff67727cfcdf1d6deaf",
                "md5": "8a093a0b7281eeac9a79a17509482ac4",
                "sha256": "72cd9c8ee7266665e2af738262ca8dc9806da6f3815d54e5bcad7ed4239cfb11"
            },
            "downloads": -1,
            "filename": "robotape-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a093a0b7281eeac9a79a17509482ac4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 23711,
            "upload_time": "2025-01-06T06:22:13",
            "upload_time_iso_8601": "2025-01-06T06:22:13.993199Z",
            "url": "https://files.pythonhosted.org/packages/91/bc/0e21cf52be6976d68d1223fb857340b9c43e69676ff67727cfcdf1d6deaf/robotape-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f2c9dc162397746e339a5ac40b2909a60a98657c6c4cf7d953cd8434b201871",
                "md5": "6135b02600d03fb23abe4b6e0a857f06",
                "sha256": "8b53083060a77219f4b85e6f0d62e8962cc432405c8c2e3c1b693771db1321cf"
            },
            "downloads": -1,
            "filename": "robotape-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6135b02600d03fb23abe4b6e0a857f06",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 17777,
            "upload_time": "2025-01-06T06:22:16",
            "upload_time_iso_8601": "2025-01-06T06:22:16.181741Z",
            "url": "https://files.pythonhosted.org/packages/4f/2c/9dc162397746e339a5ac40b2909a60a98657c6c4cf7d953cd8434b201871/robotape-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-06 06:22:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andrewlwn77",
    "github_project": "robotape",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "sqlmodel",
            "specs": [
                [
                    ">=",
                    "0.0.8"
                ]
            ]
        },
        {
            "name": "sqlalchemy",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "asyncio",
            "specs": [
                [
                    ">=",
                    "3.4.3"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    ">=",
                    "3.8.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.5.0"
                ]
            ]
        },
        {
            "name": "uuid",
            "specs": [
                [
                    ">=",
                    "1.30"
                ]
            ]
        },
        {
            "name": "mirascope",
            "specs": [
                [
                    ">=",
                    "1.14.0"
                ]
            ]
        },
        {
            "name": "mirascope",
            "specs": []
        },
        {
            "name": "mirascope",
            "specs": []
        },
        {
            "name": "mcp",
            "specs": [
                [
                    ">=",
                    "1.2.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    ">=",
                    "1.59.3"
                ]
            ]
        },
        {
            "name": "anthropic",
            "specs": [
                [
                    ">=",
                    "0.42.0"
                ]
            ]
        },
        {
            "name": "huggingface-hub",
            "specs": [
                [
                    ">=",
                    "0.27.0"
                ]
            ]
        }
    ],
    "lcname": "robotape"
}
        
Elapsed time: 0.42529s