Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dendrux

Python SDK for Dendrux — the framework for building agents with tools, persistence, and observability.

Version: 0.2.0a16

Install

pip install "dendrux[all]"              # Everything
pip install "dendrux[anthropic]"        # Anthropic + core runtime
pip install "dendrux[openai]"           # OpenAI + core runtime
pip install "dendrux[mcp]"              # Managed MCP client runtime

Quick Example

import asyncio
from dendrux import Agent, tool
from dendrux.llm.anthropic import AnthropicProvider

@tool()
async def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

async def main():
    async with Agent(
        provider=AnthropicProvider(model="claude-sonnet-4-6"),
        prompt="You are a calculator.",
        tools=[add],
    ) as agent:
        result = await agent.run("What is 15 + 27?")
        print(result.answer)

asyncio.run(main())

Managed MCP client

MCPRuntime is the application-scoped owner of process-local MCP connections. Bind cheaply for each request, hand an explicit tool view to an ephemeral Agent, and close the runtime once during application shutdown:

from dendrux import Agent
from dendrux.mcp import MCPRuntime, MCPSource

runtime = MCPRuntime(max_connections=100, max_in_flight_calls=100)

connection = runtime.bind(
    tenant_key=current_user.id,
    connection_key=github_connection.id,
    source=MCPSource.http("github", github_connection.server_url),
    credentials=credential_provider,
)

agent = Agent(
    provider=provider,
    prompt="Help with this repository.",
    tool_sources=[connection.tools(allowed_tools=["search_code", "create_issue"])],
)

try:
    result = await agent.run(user_message)
finally:
    await agent.close()  # Releases this Agent's lease.

# Once, during application shutdown:
await runtime.close()

Dendrux is the MCP client. The vendor, your platform, or a subprocess you configure hosts the MCP server. See the MCP architecture guide and multi-user example. To test a real hosted server, run the read-only GitHub example.

Providers

Provider Import Use case
Anthropic from dendrux.llm.anthropic import AnthropicProvider Claude models
OpenAI from dendrux.llm.openai import OpenAIProvider GPT models + vLLM, SGLang, Groq, Ollama
OpenAI Responses from dendrux.llm.openai_responses import OpenAIResponsesProvider GPT + built-in tools (web search)
Mock from dendrux.llm.mock import MockLLM Deterministic testing

API Quick Reference

from pathlib import Path
from dendrux.observers.console import ConsoleObserver

async with Agent(
    provider=provider,                  # Required: LLM provider
    prompt="...",                        # Required: system prompt
    tools=[add],                         # Optional: tool functions
    database_url=f"sqlite+aiosqlite:///{Path.home() / '.dendrux' / 'dendrux.db'}",
    redact=my_scrubber,                  # Optional: scrub persisted strings
) as agent:
    result = await agent.run(
        "What is 15 + 27?",
        observer=ConsoleObserver(),      # Optional: terminal output
        tenant_id="org-123",             # Optional: multi-tenant isolation
        metadata={"thread": "t1"},       # Optional: your linking data
    )

RunResult

result.answer          # str | None — the agent's final answer
result.status          # RunStatus — SUCCESS, ERROR, MAX_ITERATIONS, WAITING_CLIENT_TOOL, CANCELLED
result.steps           # list[AgentStep] — full reasoning chain
result.iteration_count # int — how many loop iterations ran
result.usage           # UsageStats — input_tokens, output_tokens, total_tokens
result.run_id          # str — unique run identifier (ULID)
result.error           # str | None — error message if status is ERROR

Tool Options

@tool()                                  # Basic server tool
@tool(target="client")                   # Client-side — agent pauses
@tool(max_calls_per_run=3)               # Limit calls per run
@tool(timeout_seconds=120)               # Custom timeout (default 120s)
@tool(parallel=False)                    # Run alone, not concurrently

Full Documentation

See the full documentation on GitHub for provider setup, configuration, database guide, CLI, dashboard, observer system, and examples.

Release files for dendrux 0.2.0a17

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

Source distribution (sdist)

Source distribution for dendrux 0.2.0a17
File Size Uploaded
dendrux-0.2.0a17.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dendrux 0.2.0a17
File Interpreter ABI Platform
dendrux-0.2.0a17-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / dendrux-0.2.0a17.tar.gz

Download URL dendrux-0.2.0a17.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
80c334fa61352e7862c61773078ad6418e90b123ae72bc78f6a8066b3481e9fe
BLAKE2b-256 checksum
How to use checksums
8b0e0aba236bc0aa9c1a4e51b7f06153d95b8b217ba3b0a2794de1fa3f2dd3fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / dendrux-0.2.0a17-py3-none-any.whl

Download URL dendrux-0.2.0a17-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ba1c43d6e7ba3a5cc200b8fb18029a8eb0d9c44be9a391b0c9ac5dbf24a6964b
BLAKE2b-256 checksum
How to use checksums
3e92e4771379a25775baaa54a14291f94c9e7385f0b6fe84b6fb5a2a8a2e0e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12
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