Skip to main content

Generate Agent Integration Kits for existing systems with AI-powered dynamic generation via Claude Agent SDK.

Project description

๐ŸŒ‰ AgentBridge

Turn your existing system into an AI-agent-ready platform โ€” in seconds.

License: MIT Python 3.10+ PRs Welcome

English ยท ไธญๆ–‡


AgentBridge discovers capabilities from your API schemas, database schemas, and source routes, then generates a complete Agent Integration Kit that works with MCP, Claude, OpenAI, and Vercel AI SDK out of the box.

With built-in Claude Agent SDK support and AI-powered dynamic generation, AgentBridge goes beyond static templates โ€” it uses AI to craft richer tool definitions, domain-specific skills, and intelligent prompts tailored to your system.

๐Ÿ“‘ Table of Contents


โœจ Features

๐Ÿ” Auto-discovery Extracts capabilities from OpenAPI, GraphQL, SQL, and source code routes (Python/Flask/FastAPI, JS/Express, Java/Spring)

๐Ÿ”ง Multi-format Generation Outputs MCP, Claude, OpenAI, and Vercel AI SDK tool definitions simultaneously

๐Ÿค– AI-Powered Generation Uses Claude Agent SDK (primary) or Anthropic API (fallback) to dynamically generate tools, skills, and prompts

๐Ÿง  Agent as a Service Runs as an interactive agent for your existing project via Claude Agent SDK

๐Ÿ›ก๏ธ Safety-first Classifies operations by risk level with human-in-the-loop confirmation for dangerous actions

๐Ÿงช Dry-run Validation Test tool invocations against generated guardrails before executing

๐ŸŒ Custom LLM Providers Supports DeepSeek, OpenRouter, and any Anthropic-compatible endpoint

๐Ÿชถ Dependency-light Core Deterministic generator runs on Python standard library only; AI features are opt-in


๐Ÿš€ Quick Start

Installation

pip install agbr
๐Ÿ“ฆ Install with optional features
# AI-powered generation + agent sessions (recommended)
pip install "agbr[agent]"

# Lightweight AI generation (no Claude Agent SDK)
pip install "agbr[ai]"

# Everything
pip install "agbr[all]"

# Install from source (for development)
git clone https://github.com/your-username/AgentBridge.git
cd AgentBridge
pip install -e ".[all]"

Configure LLM Provider

AgentBridge requires an LLM API key for AI features. By default it uses Anthropic's Claude, but you can configure any Anthropic-compatible provider:

# Required
export ANTHROPIC_API_KEY="sk-ant-..."

# Optional: Custom API endpoint
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"   # DeepSeek
# export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"       # OpenRouter

# Optional: Custom model name
export ANTHROPIC_MODEL="deepseek-v4-flash"
๐Ÿ”‘ Or pass via CLI flags
agentbridge generate examples/writing_system --output build/kit --ai \
  --api-key "sk-..." \
  --base-url "https://api.deepseek.com/anthropic" \
  --model "deepseek-v4-flash"

Note: When ANTHROPIC_BASE_URL is set, AgentBridge automatically uses the anthropic SDK backend (not claude-agent-sdk) for generation, since custom endpoints are not supported by the agent SDK.

Generate an Agent Integration Kit

# Deterministic generation (no API key needed)
agentbridge generate examples/writing_system --output .agentbridge/writing-kit

# AI-powered generation (requires API key)
agentbridge generate examples/writing_system --output .agentbridge/writing-kit --ai

Run as an Agent

agentbridge chat .agentbridge/writing-kit

Run Tests

PYTHONPATH=src python -m unittest discover -s tests

๐Ÿ“– CLI Reference

Command Description
agentbridge discover <paths> Discover and print capabilities as JSON
agentbridge generate <paths> -o <dir> Generate an Agent Integration Kit
agentbridge dry-run <kit> <tool> Dry-run a tool invocation
agentbridge chat <kit> Start an interactive AI agent session
๐Ÿ“ Full command details

discover

agentbridge discover examples/writing_system

generate

# Deterministic
agentbridge generate examples/writing_system --output build/agent-kit

# AI-powered
agentbridge generate examples/writing_system --output build/agent-kit --ai

# With custom name
agentbridge generate examples/writing_system --output build/agent-kit --name my-kit

# With custom LLM provider
agentbridge generate examples/writing_system --output build/agent-kit --ai \
  --api-key "sk-..." --base-url "https://api.deepseek.com/anthropic" --model "deepseek-v4-flash"

dry-run

# Normal invocation
agentbridge dry-run build/agent-kit create_chapter --args '{"project_id":"p1","title":"Opening"}'

# High-risk operation (requires confirmation)
agentbridge dry-run build/agent-kit delete_character \
  --args '{"project_id":"p1","character_id":"c1"}' --confirmed

chat

agentbridge chat build/agent-kit
# Or with custom LLM provider:
agentbridge chat build/agent-kit --api-key "sk-..." --base-url "https://api.deepseek.com/anthropic"

๐Ÿ” What AgentBridge Discovers

Source Type Formats
๐ŸŒ API Schemas OpenAPI JSON/YAML, GraphQL schemas
๐Ÿ—„๏ธ Database Schemas SQL CREATE TABLE statements
๐Ÿ Python Routes FastAPI @router.get/post/..., Flask @app.route
๐Ÿ“œ JavaScript Routes Express app.get/post/...
โ˜• Java Routes Spring @GetMapping/@PostMapping/...

All sources are normalized into a common capability model with:

Field Description
domain + resource Logical grouping
action What the capability does
input_schema JSON Schema parameters
risk read / write / destructive / external_side_effect
confirm_required Whether human approval is needed
source Full traceability back to the origin file

๐Ÿ“ Generated Kit Layout

agent-kit/
โ”œโ”€โ”€ manifest.json                  # Kit metadata and summary
โ”œโ”€โ”€ capabilities.json              # All discovered capabilities
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ mcp_tools.json             # MCP tool definitions
โ”‚   โ”œโ”€โ”€ openai_tools.json          # OpenAI function calling format
โ”‚   โ”œโ”€โ”€ claude_tools.json          # Claude tool use format
โ”‚   โ””โ”€โ”€ vercel_ai_tools.ts         # Vercel AI SDK TypeScript tools
โ”œโ”€โ”€ skills/
โ”‚   โ””โ”€โ”€ writing.md                 # Domain-specific skill definitions
โ”œโ”€โ”€ prompts/
โ”‚   โ””โ”€โ”€ system.md                  # Agent system prompt
โ”œโ”€โ”€ resources/
โ”‚   โ””โ”€โ”€ schema.json                # Resource schema summary
โ”œโ”€โ”€ guardrails/
โ”‚   โ””โ”€โ”€ permissions.json           # Risk policy and confirmation rules
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ tool_invocation_tests.json # Auto-generated invocation tests
โ”‚   โ””โ”€โ”€ test_generated_tools.py    # Python unit tests for tool contracts
โ””โ”€โ”€ dry_run_plan.json              # Dry-run execution plan

๐Ÿค– AI-Powered Generation

When you use --ai, AgentBridge uses Claude to dynamically generate:

What Description
๐Ÿ“ Enhanced tool descriptions Context-aware descriptions that capture business semantics
๐ŸŽฏ Domain-specific skills Workflow prompts tailored to your domain with best practices
๐Ÿง  Intelligent system prompts Prompts that understand resource relationships and suggest safe sequences
๐Ÿ” Inferred additional tools Tools implied by your schema but not explicitly present
โš ๏ธ Improved risk assessments Context-aware risk classification beyond keyword matching

AI Backend

Backend Package Use Case
Claude Agent SDK (primary) claude-agent-sdk Generation + interactive agent sessions
Anthropic API (fallback) anthropic Generation only, supports custom endpoints

When claude-agent-sdk is installed and no custom ANTHROPIC_BASE_URL is set, it is used automatically. When a custom endpoint is configured or claude-agent-sdk is not installed, the anthropic SDK is used.

Programmatic Usage

from pathlib import Path
from agentbridge.generator import AgentKitGenerator
from agentbridge.agent import AIGenerator, AgentRunner

# Deterministic generation (no API key needed)
kit = AgentKitGenerator().generate(
    [Path("examples/writing_system")],
    Path("build/agent-kit"),
)

# AI-powered generation (API key required)
ai = AIGenerator(api_key="sk-ant-...")
kit = AgentKitGenerator(ai_generator=ai).generate(
    [Path("examples/writing_system")],
    Path("build/agent-kit"),
)

# Custom LLM provider (e.g., DeepSeek)
ai = AIGenerator(
    api_key="sk-d831ecabc21842fdae6f30c24dd3b052",
    base_url="https://api.deepseek.com/anthropic",
    model="deepseek-v4-flash",
)

# Agent session
import asyncio
async def main():
    runner = AgentRunner(kit_dir="build/agent-kit", api_key="sk-ant-...")
    async for message in runner.query("List all chapters in project p1"):
        print(message)
asyncio.run(main())

๐Ÿ›ก๏ธ Safety Model

Risk Level Confirmation Examples
๐ŸŸข read Not required GET, list, search, find
๐ŸŸก write Optional by policy POST, create, update, rewrite
๐Ÿ”ด destructive Required DELETE, remove, destroy, drop, cancel
๐ŸŸ  external_side_effect Required publish, send, email, pay, deploy, export

The safety model is applied consistently across both deterministic and AI-generated outputs. AI-generated tools are always validated against the same guardrails.


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Discovery   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Generator   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Agent Kit      โ”‚
โ”‚  (schemas,   โ”‚     โ”‚  (determin-  โ”‚     โ”‚  (tools, skills,โ”‚
โ”‚   routes,    โ”‚     โ”‚   istic + AI)โ”‚     โ”‚   prompts,      โ”‚
โ”‚   SQL)       โ”‚     โ”‚              โ”‚     โ”‚   guardrails)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚                      โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  AI Generatorโ”‚       โ”‚  Agent Runner โ”‚
                    โ”‚  (Claude SDK โ”‚       โ”‚  (Claude SDK  โ”‚
                    โ”‚   / Anthropicโ”‚       โ”‚   Client +    โ”‚
                    โ”‚   API)       โ”‚       โ”‚   MCP Tools)  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฉ Extending AgentBridge

Extension How
New schema parser Implement a discoverer in discovery.py
New tool format Add a builder function in generator.py
Custom AI prompts Override prompts in agent.py
Custom risk policy Modify policy.py
Custom agent tools Extend AgentRunner._build_kit_tools()

๐Ÿ“ฆ Publishing & Installation

๐Ÿ”ง How does `pip install "agbr"` work?

AgentBridge is packaged as a standard Python package using pyproject.toml + setuptools. Here's the mechanism:

1. Package Structure

AgentBridge/
โ”œโ”€โ”€ pyproject.toml          # Package metadata, dependencies, entry points
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ agentbridge/        # Actual Python package
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ cli.py          # CLI entry point
โ”‚       โ”œโ”€โ”€ agent.py
โ”‚       โ”œโ”€โ”€ generator.py
โ”‚       โ””โ”€โ”€ ...
โ””โ”€โ”€ tests/

2. pyproject.toml Key Sections

[project]
name = "agbr"                    # pip install agbr
version = "0.2.0"

[project.optional-dependencies]         # pip install "agbr[agent]"
agent = ["claude-agent-sdk>=0.1.0"]
ai = ["anthropic>=0.30.0"]

[project.scripts]
agentbridge = "agentbridge.cli:main"    # CLI entry point

[tool.setuptools.packages.find]
where = ["src"]                         # Code lives in src/

3. How pip install Works

  1. Build: pip reads pyproject.toml, uses setuptools to build a wheel (.whl)
  2. Install: The wheel is installed into your Python environment's site-packages/
  3. CLI: The [project.scripts] section creates a agentbridge executable in your PATH that calls agentbridge.cli:main

4. Publishing to PyPI (so anyone can pip install)

# Build the package
pip install build
python -m build

# Upload to TestPyPI (for testing)
pip install twine
twine upload --repository testpypi dist/*

# Upload to PyPI (for real)
twine upload dist/*

After publishing, anyone can run pip install "agbr".

5. Installing Without PyPI

Until the package is published on PyPI, users can install it in these ways:

# Install from local source (editable mode, for development)
pip install -e .

# Install from GitHub repository
pip install git+https://github.com/your-username/AgentBridge.git

# Install from a local wheel
pip install dist/agentbridge-0.2.0-py3-none-any.whl

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  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

Please make sure tests pass:

PYTHONPATH=src python -m unittest discover -s tests -v

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.

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

agbr-0.2.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

agbr-0.2.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file agbr-0.2.0.tar.gz.

File metadata

  • Download URL: agbr-0.2.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for agbr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5403efcf4ab48409dfe5003790bd66d48e306ecd81c021e2cbb98703f2f07ea7
MD5 e22c8b033cfa7653ceff9f6ce245a88c
BLAKE2b-256 f7d7fea9325262a96c36cebf1e6d7ff281372f2a32572f65bcc21e74138b891c

See more details on using hashes here.

File details

Details for the file agbr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agbr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for agbr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72cb7d2a1bdeccfb1ea2121f4fc9608ad751a27c5f0e175f115ba41102fc8c23
MD5 fa503e3e0021c07ad45d0f41ae275445
BLAKE2b-256 380ff53a6e6b94c058ffe85134782204e83e42c0c8329b434d70e5ad09004d10

See more details on using hashes here.

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