Skip to main content

CAL (Creevo Agent Library) - A Python library for building agentic AI applications with LLM abstraction, tool management, and conversation memory

Project description

CAL (Creevo Agent Library)

CAL is a Python library for building agentic AI applications with LLM abstraction, tool management, and conversation memory.

Installation

pip install creevo-agent-library

With MCP support:

pip install "creevo-agent-library[mcp]"

Quick Start

import os
from CAL import Agent, GeminiLLM, StopTool, FullCompressionMemory

# Initialize LLM (uses GEMINI_API_KEY env var when api_key is None)
llm = GeminiLLM(model="gemini-2.5-flash", api_key=None, max_tokens=4096)

# Initialize memory with a summarizer LLM (required for compression)
summarizer_llm = GeminiLLM(model="gemini-2.0-flash", api_key=None, max_tokens=2048)
memory = FullCompressionMemory(summarizer_llm=summarizer_llm, max_tokens=50000)

# Create agent
agent = Agent(
    llm=llm,
    system_prompt="You are a helpful assistant.",
    max_calls=10,
    max_tokens=4096,
    memory=memory,
    agent_name="my-agent",
    tools=[StopTool()]
)

# Run agent
result = agent.run("Hello, how can you help me?")
print(result.content)

Architecture

CAL provides:

  • Agent: Agentic loop implementation with tool execution
  • LLM: Abstract base class with Gemini and Anthropic implementations
  • Memory: Conversation memory management with compression support
  • Tool: Tool system with @tool decorator for easy tool creation
  • Message: Message and content block types for conversation handling
  • Logger: OpenTelemetry and Maxim AI logging support

Components

Agent

The Agent class implements the agentic loop:

  1. LLM generates response (may include tool calls)
  2. Parse tool uses from response
  3. Execute tools in parallel
  4. Add tool results to memory
  5. Repeat until completion or max iterations

LLM Providers

  • GeminiLLM: Google Gemini API integration
  • AnthropicVertexLLM: Anthropic Claude via Vertex AI (stub)

Memory

  • FullCompressionMemory: LLM-based compression that keeps initial prompt, summarizes middle turns using an LLM, and keeps recent messages. Requires a summarizer_llm for compression.

Tools

CAL provides three ways to give an agent tools:

@tool decorator — wrap an async function as a tool:

from CAL import tool

@tool
async def my_tool(param1: str, param2: int):
    """Tool description"""
    return {
        "content": [{"type": "text", "text": f"Result: {param1}, {param2}"}],
        "metadata": {}
    }

@subagent decorator — delegate to a specialized sub-agent (see src/CAL/subagent.py).

MCP servers — connect to any Model Context Protocol server and use its tools as regular CAL tools (install with pip install "creevo-agent-library[mcp]"):

from CAL.mcp import connect_mcp_server, disconnect_mcp_tools

# Returns a list of MCPTool instances — same interface as @tool and @subagent
mcp_tools = await connect_mcp_server(command="npx", args=["-y", "@upstash/context7-mcp"])

agent = Agent(
    llm=GeminiLLM(model="gemini-3-flash-preview", api_key="...", max_tokens=4096),
    system_prompt="You are a helpful assistant.",
    max_calls=10,
    max_tokens=4096,
    memory=FullCompressionMemory(
        summarizer_llm=GeminiLLM(model="gemini-3-flash-preview", api_key="...", max_tokens=2048),
        max_tokens=50000,
    ),
    agent_name="mcp-agent",
    tools=[StopTool(), *mcp_tools],  # mix with any other CAL tools
)

result = await agent.run_async("What does React useEffect do?")
await disconnect_mcp_tools(mcp_tools)

See examples/mcp_context7_agent.ipynb for a full walkthrough.

Documentation

For detailed API documentation, see the wiki.

License

MIT License

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

creevo_agent_library-0.1.0.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

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

creevo_agent_library-0.1.0-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

Details for the file creevo_agent_library-0.1.0.tar.gz.

File metadata

  • Download URL: creevo_agent_library-0.1.0.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for creevo_agent_library-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ccb5fb7fa929f64a02afed01d1ca04b4c334d113e58b9fdfbb4e7bf9d1001f2
MD5 5c7c70ca180973909d01c5cfae17959e
BLAKE2b-256 9e5ee57e6c764d2daf7ba96431df2fa149af27c143c9ccae2b09c0e38d27b055

See more details on using hashes here.

Provenance

The following attestation bundles were made for creevo_agent_library-0.1.0.tar.gz:

Publisher: publish.yml on Creevo-App/creevo-agent-library

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

File details

Details for the file creevo_agent_library-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for creevo_agent_library-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e813c361686b6748a4251c7b1e1a033a07581667d66d6ddb88ce0b11ea9e4e5
MD5 7710652b0b42b4fbd01f206181d97cb9
BLAKE2b-256 944292edf8094391aa7ec452944b5a732975fd62d96e3974fa02b7e7e532ad69

See more details on using hashes here.

Provenance

The following attestation bundles were made for creevo_agent_library-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Creevo-App/creevo-agent-library

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