Skip to main content

Agent-Based Infrastructure Core - Runtime and CLI

Project description

ABI Swarm ๐Ÿค–

PyPI version Python License Documentation

ABI Swarm is a self-building multi-agent system. It plans, orchestrates, and creates agents on demand โ€” governed by policy at every step.

ABI-Core is the framework underneath: the foundation for building Agent-Based Infrastructure where intelligent agents collaborate through semantic context, policy-driven governance, and modular orchestration.

Beta Release โ€” APIs may change. Feedback welcome.


What Makes ABI Different

Most agent frameworks assume your agents and tools already exist. ABI doesn't.

  • The Orchestrator triages requests (simple vs complex) and coordinates execution
  • The Guardian validates every query for prompt injection and policy compliance before it reaches any agent
  • The Planner decomposes complex requests into tasks using Tree of Thoughts reasoning
  • The Builder creates ephemeral agents on demand โ€” Docker containers that live, execute, and die
  • The Semantic Layer connects everything through vector search, MCP tools, and artifact storage
  • The MinIO Artifact Store provides object storage for code, data, and results between agents

If an agent doesn't exist for a task, ABI builds one. If a tool doesn't exist, ABI creates it. All governed by policy.


Quick Start

pip install abi-core-ai

# Create a complete swarm (project + all agents + services)
abi-core create swarm --name my-swarm

# Or step by step:
abi-core create project my-system --with-semantic-layer --with-guardian
abi-core add abi-swarm

# Run
abi-core run              # Detached (banner + status only)
abi-core run --logs       # With container logs
abi-core run --build      # Rebuild containers first

Architecture

User Request
     โ”‚
     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Orchestrator                     โ”‚
โ”‚                                                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚
โ”‚  โ”‚  Triage     โ”‚  โ”‚  Guardian Gate   โ”‚  Level 0  โ”‚
โ”‚  โ”‚  (simple/   โ”‚  โ”‚  (security       โ”‚  parallel โ”‚
โ”‚  โ”‚   complex)  โ”‚  โ”‚   validation)    โ”‚           โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚
โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                      โ”‚
โ”‚                  โ–ผ                                 โ”‚
โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                        โ”‚
โ”‚         โ”‚ Gate Decision  โ”‚  Level 1               โ”‚
โ”‚         โ”‚ approve/block/ โ”‚  merge                 โ”‚
โ”‚         โ”‚ respond/plan   โ”‚                        โ”‚
โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                        โ”‚
โ”‚                 โ”‚                                  โ”‚
โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”‚
โ”‚    โ–ผ                         โ–ผ                    โ”‚
โ”‚  Simple                   Complex                 โ”‚
โ”‚  โ†’ LLM responds           โ†’ Planner โ†’ Builder    โ”‚
โ”‚    directly                 โ†’ Execute โ†’ Synthesizeโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                         โ”‚
         โ–ผ                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Semantic   โ”‚  โ”‚  Guardian   โ”‚  โ”‚   MinIO      โ”‚
โ”‚   Layer     โ”‚  โ”‚  Security   โ”‚  โ”‚  Artifacts   โ”‚
โ”‚             โ”‚  โ”‚             โ”‚  โ”‚              โ”‚
โ”‚ Agent Cards โ”‚  โ”‚ OPA Policiesโ”‚  โ”‚ Code, Data   โ”‚
โ”‚ Tool Cards  โ”‚  โ”‚ A2A Auth    โ”‚  โ”‚ Results      โ”‚
โ”‚ Service Cardsโ”‚ โ”‚ Audit Log   โ”‚  โ”‚ S3-compat    โ”‚
โ”‚ MCP Tools   โ”‚  โ”‚ Risk Score  โ”‚  โ”‚              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Concepts

AbiCore โ€” FastAPI-style Agent Runner

from abi_core.agent import AbiCore
from my_agent import MyAgent

agent = AbiCore()

@agent.task(name="step1")
def step1(raw_input):
    return {"cleaned": raw_input.strip()}

@agent.task(name="step2", depends_on=["step1"], input_map={"data": "$step1.result"})
def step2(data):
    return {"stored": True}

@agent.tool(name="search")
def search(query):
    """Available to the LLM on demand."""
    return {"results": []}

@agent.mcp_tool(name="bigquery_search", input_map={"query": "$input.user_query"})

agent.run(MyAgent())

invoke() โ€” Unified LLM Calls

from abi_core.agent import invoke

# LLM only, no context
result = await invoke(config.LLM_CONFIG, "Classify this query...")

# LLM with conversation memory
result = await invoke(config.LLM_CONFIG, "Summarize...", thread_id=context_id)

# Agent with tools, no context
result = await invoke(config.LLM_CONFIG, "Find agent...", tools=[tool_find_agent])

# Agent with tools and memory
result = await invoke(config.LLM_CONFIG, query, tools=[find, search], thread_id=session_id)

ToolExecutionGraph โ€” Deterministic DAG with Parallelism

Tasks registered with @agent.task() are wired into a LangGraph DAG. Nodes at the same dependency level execute in parallel. The LLM never decides execution order โ€” the graph does. Retry, checkpoint/resume, and $reference resolution between nodes are built in.

Three Types of Cards

Card Purpose Example
AgentCard Identity for agents (permanent or ephemeral) Planner, Builder, zombie agents
ServiceCard Identity for non-agent services Webapp, semantic layer
ToolCard Metadata for MCP tools with access_scope query_sales_db, send_email

All cards support HMAC authentication, checksum verification, and OPA policy evaluation.

Zombie Container Pattern

Ephemeral agents run a 3-phase DAG:

  1. gather_context โ€” Pull artifacts from MinIO, prepare workspace
  2. analyze_and_execute โ€” LLM autonomous with tools (decides what to call)
  3. synthesize_and_report โ€” Package results, upload artifacts

No docker build โ€” just docker run with env vars. The zombie self-configures as a fully functional A2A agent.


Features

  • AbiCore Runner โ€” agent = AbiCore() with auto-config import
  • Decorator API โ€” @agent.task(), @agent.tool(), @agent.mcp_tool()
  • ToolExecutionGraph โ€” LangGraph DAG with parallel execution and Annotated reducers
  • invoke() โ€” Unified LLM calls: LLM-only, agent+tools, with/without context
  • SSE Heartbeat โ€” Automatic keepalive for CloudFront/proxy compatibility
  • Session Management โ€” Auto process_answer(), clear_session(), _yield_clarification() in AbiAgent base
  • AgentResponse โ€” Typed responses: .success(), .error(), .status(), .input_required()
  • A2AResponse โ€” Streaming event parser for TaskArtifactUpdateEvent and TaskStatusUpdateEvent
  • Multi-Provider LLM โ€” Ollama, OpenAI, Anthropic, Bedrock, Azure, Vertex AI, Grok
  • MCP Protocol โ€” Streamable HTTP transport with auto-reconnection
  • MCPToolkit โ€” Dynamic tool calling with ServiceCard or AgentCard auth
  • Three Card Types โ€” AgentCard, ServiceCard, ToolCard with HMAC, checksum, access_scope
  • Guardian Gate โ€” Parallel triage + security validation before any agent executes
  • OPA Policies โ€” Support for agent://, service://, tool:// prefixes and ephemeral agents
  • Semantic Layer โ€” Weaviate vector search for agents, tools, and services
  • ArtifactStore โ€” S3-compatible object storage (MinIO local, AWS S3, GCS production)
  • ContainerRuntime โ€” Docker lifecycle abstraction (run, destroy, health check)
  • Builder โ€” Creates ephemeral agents with register/deregister lifecycle
  • Zombie Pattern โ€” 3-phase DAG: gather โ†’ execute (LLM autonomous) โ†’ report
  • Tree of Thoughts โ€” Planner and Orchestrator prompts with multi-path reasoning
  • Infrastructure Filter โ€” Prevents builder/planner/orchestrator from being assigned as task executors
  • CLI โ€” abi-core create swarm, abi-core create project, abi-core add abi-swarm, abi-core run

CLI Commands

# Swarm (everything in one command)
abi-core create swarm --name <name>

# Project (step by step)
abi-core create project <name> [--with-semantic-layer] [--with-guardian]
abi-core add abi-swarm

# Run
abi-core run              # Detached (banner + status table)
abi-core run --logs       # With container logs
abi-core run --build      # Rebuild containers

# Agents
abi-core add agent <name> --description "..."
abi-core remove agent <name>

# Services
abi-core add semantic-layer
abi-core add service guardian-native

Project Structure

my-swarm/
โ”œโ”€โ”€ agents/
โ”‚   โ”œโ”€โ”€ planner/          # Task decomposition (Tree of Thoughts)
โ”‚   โ”œโ”€โ”€ orchestrator/     # Triage + Guardian gate + workflow coordination
โ”‚   โ”œโ”€โ”€ builder/          # Ephemeral agent creation + registration
โ”‚   โ””โ”€โ”€ my-agent/         # Your custom agents
โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ web_api/          # FastAPI application + ServiceCard
โ”‚   โ”‚   โ””โ”€โ”€ service_cards/
โ”‚   โ”œโ”€โ”€ semantic_layer/   # MCP server + Weaviate
โ”‚   โ”‚   โ”œโ”€โ”€ agent_cards/
โ”‚   โ”‚   โ”œโ”€โ”€ tool_cards/
โ”‚   โ”‚   โ””โ”€โ”€ service_cards/
โ”‚   โ””โ”€โ”€ guardian/         # OPA security + audit
โ”œโ”€โ”€ compose.yaml          # All services + MinIO + OPA
โ””โ”€โ”€ .abi/runtime.yaml

Documentation

https://abi-core.readthedocs.io


Contributing

git clone https://github.com/Joselo-zn/abi-core
cd abi-core-ai
uv sync --dev
uv run pytest

License

Apache 2.0 โ€” see LICENSE


Built by Josรฉ Luis Martรญnez โ€” Creator of ABI (Agent-Based Infrastructure)

Project details


Release history Release notifications | RSS feed

This version

1.9.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abi_core_ai-1.9.2.tar.gz (266.7 kB view details)

Uploaded Source

Built Distribution

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

abi_core_ai-1.9.2-py3-none-any.whl (314.0 kB view details)

Uploaded Python 3

File details

Details for the file abi_core_ai-1.9.2.tar.gz.

File metadata

  • Download URL: abi_core_ai-1.9.2.tar.gz
  • Upload date:
  • Size: 266.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for abi_core_ai-1.9.2.tar.gz
Algorithm Hash digest
SHA256 db2bb2ee36f9feb628bbcb4d26b7dec35769807e1a7ca53e6963c9f5927d3743
MD5 5ce8104751fa679e75a1d58787482814
BLAKE2b-256 4d812f91413d3ce7df0b210ead372863ddd6626dcf4956aa756520a4243156c0

See more details on using hashes here.

File details

Details for the file abi_core_ai-1.9.2-py3-none-any.whl.

File metadata

File hashes

Hashes for abi_core_ai-1.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07f13219aa09c85de09e53f2888e7d3d70824b5476e31f9e8a51f54ffdf7eabc
MD5 23a4873a73cba1e28c9ac05af9b1dec2
BLAKE2b-256 b7da9b92bc1a4ff55122b612ce3d434410b45056ea3b346794156e4a5491e7ce

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