Skip to main content

Rakam Systems Agent

The agent package of Rakam Systems providing AI agent implementations powered by Pydantic AI.

Overview

rakam-systems-agent provides flexible AI agents with tool integration, chat history, and LLM gateway abstractions. This package depends on rakam-systems-core.

Features

  • Configuration-First Design: Change agents without code changes — just update YAML files
  • Async/Sync Support: Full support for both synchronous and asynchronous agent operations
  • Tool Integration: Easy tool definition and integration using the Tool.from_schema pattern
  • Model Settings: Control model behavior including parallel tool calls, temperature, and max tokens
  • Pydantic AI Powered: Built on top of Pydantic AI library
  • Streaming Support: Both sync and async streaming interfaces
  • Chat History: Multiple backends (JSON, SQLite, PostgreSQL)
  • LLM Gateway: Unified interface for OpenAI and Mistral AI

Installation

pip install rakam-systems-agent

Available extras:

Extra What it adds Needed for
llm-providers openai, mistralai, tiktoken OpenAIGateway, MistralGateway, LLMGatewayFactory, get_llm_gateway
postgres psycopg2-binary PostgresChatHistory
all Everything above
pip install rakam-systems-agent[all]

The extras are genuinely optional: BaseAgent, ModelGateway, JSONChatHistory and SQLChatHistory work on a bare install. The symbols in the table are resolved on first access and raise an ImportError naming the extra to install if it is missing.

Quick Start

import asyncio
from rakam_systems_agent import BaseAgent
from rakam_systems_core.ai_core.interfaces import ModelSettings
from rakam_systems_core.ai_core.interfaces.tool import ToolComponent as Tool

async def get_weather(city: str) -> dict:
    """Get weather information for a city"""
    return {"city": city, "temperature": 72, "condition": "sunny"}

agent = BaseAgent(
    name="weather_agent",
    model="openai:gpt-4o",
    system_prompt="You are a helpful weather assistant.",
    tools=[
        Tool.from_schema(
            function=get_weather,
            name='get_weather',
            description='Get weather information for a city',
            json_schema={
                'type': 'object',
                'properties': {
                    'city': {'type': 'string', 'description': 'The city name'},
                },
                'required': ['city'],
                'additionalProperties': False,
            },
            takes_ctx=False,
        ),
    ],
)

async def main():
    result = await agent.arun(
        "What's the weather in San Francisco?",
        model_settings=ModelSettings(parallel_tool_calls=True),
    )
    print(result.output_text)

asyncio.run(main())

Core Components

  • BaseAgent — Primary agent implementation powered by Pydantic AI, with tool support and streaming
  • Tool — Wrapper for tool functions using Tool.from_schema pattern
  • ModelSettings — Configure parallel tool calls, temperature, max tokens
  • LLM Gateway — Provider-agnostic interface for OpenAI and Mistral (details)
  • ModelGateway — Factory resolving a provider:model ref to a configured pydantic-ai model, with model settings and custom provider clients
  • Chat History — JSON, SQLite, and PostgreSQL backends
  • MCP Server — Message-based component registry for agent tools (details)

Package Structure

rakam-systems-agent/
├── src/rakam_systems_agent/
│   ├── components/
│   │   ├── base_agent.py         # BaseAgent (Pydantic AI-powered)
│   │   ├── llm_gateway/          # LLM provider gateways (raw SDK)
│   │   ├── model_gateway/        # ModelGateway (pydantic-ai model factory)
│   │   ├── chat_history/         # Chat history backends
│   │   ├── tools/                # Built-in tools
│   │   └── __init__.py           # Exports
│   └── server/                   # MCP server
└── pyproject.toml

Documentation

For API reference, advanced usage (dependencies, streaming, YAML config), and troubleshooting, see the official documentation.

Contributing

When adding new agent types:

  1. Inherit from BaseAgent
  2. Implement ainfer() for async or infer() for sync
  3. Add tests in tests/

License

See main project LICENSE file.

Release files for rakam-systems-agent 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rakam-systems-agent 0.1.6
File Size Uploaded
rakam_systems_agent-0.1.6.tar.gz 45.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rakam-systems-agent 0.1.6
File Interpreter ABI Platform
rakam_systems_agent-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 109.5 kB

Release files / rakam_systems_agent-0.1.6.tar.gz

Download URL rakam_systems_agent-0.1.6.tar.gz
Size 45.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b29bad4501660439e436f0b8c2407400c6b95b4f57ff3e0f29c85147c4ac8bbe
BLAKE2b-256 checksum
How to use checksums
f7df6b7297883449826a96bfe9cff4037623eeade1ca7aa03655622ce95505e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / rakam_systems_agent-0.1.6-py3-none-any.whl

Download URL rakam_systems_agent-0.1.6-py3-none-any.whl
Size 64.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d92440707973d0d7a185d662c83ac1dde0ab40d5c2d1d83b24be4ed500d927d8
BLAKE2b-256 checksum
How to use checksums
b7ba756a24a0be7e680c15c86f46db1067c87cc8858f6be215532ceffe1383e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page