How openabdev/openab works
Purpose and Entrypoints
OpenAB is a Rust “thin broker” that connects chat platforms to ACP-compatible coding agents. The primary executable starts from src/main.rs; it hosts Discord/Slack and optionally embedded gateway adapters. Core reusable broker logic is in crates/openab-core/src/lib.rs. Separate binaries provide the standalone gateway, native agent, control plane, ACP adapter, auth proxy, and ECS operator.
Broker Core: Inbound Turn to Agent Session
Platform events are normalized into dispatchable turns, then routed by thread/session identity to a pooled ACP agent process. The core boundary is ACP JSON-RPC over child-process stdio; chat-specific logic should not cross it.
• crates/openab-core/src/dispatch.rs
• crates/openab-core/src/bot_turns.rs
• crates/openab-core/src/acp/pool.rs
• crates/openab-core/src/acp/connection.rs
The pool owns one agent process per conversation thread, enforces concurrency and TTL, and streams agent output back through the originating adapter.
Native Chat Adapters and Reply Behavior
Discord and Slack are first-class in-process integrations. They enforce platform authorization/triggering, create or follow threads, render markdown/media, stream edits, and apply reactions. Agent output directives affect reply targeting and presentation before outbound delivery.
• crates/openab-core/src/discord.rs
• crates/openab-core/src/slack.rs
• crates/openab-core/src/directives.rs
• crates/openab-core/src/format.rs
Gateway Boundary for Additional Platforms
The gateway isolates webhook/API and platform protocol handling for Telegram, LINE, Feishu/Lark, Google Chat, WeCom, and Teams. It can run independently and communicate with OpenAB over WebSocket/ACP, or be linked into the unified binary. This preserves the same dispatcher-to-ACP boundary regardless of platform.
• crates/openab-gateway/src/main.rs
• crates/openab-gateway/src/adapters/acp_server.rs
• crates/openab-gateway/src/adapters/telegram.rs
• src/unified_adapter.rs
Gateway configuration/schema validation is formalized by crates/openab-gateway/schemas/acp-v1.schema.json.
Agent Backends and AgentCore
Configured agent commands run locally as ACP stdio processes, allowing multiple external CLIs without broker changes. ACP protocol, process launch, and remote AgentCore adaptation reside in core. AgentCore replaces the local CLI execution boundary with AWS Bedrock AgentCore runtime invocation.
• crates/openab-core/src/acp/protocol.rs
• crates/openab-core/src/adapter.rs
• crates/openab-core/src/acp/agentcore.rs
• agentcore/runtimes/kiro/run.sh
A native Rust agent is separately executable and exposes ACP, LLM, skills, and tools:
• openab-agent/src/main.rs
• openab-agent/src/agent.rs
• openab-agent/src/mcp.rs
MCP and Control-Plane Extensions
The MCP crate provides agent-facing tool/runtime integration, including auth, OAuth, native Gmail, LLM access, source discovery, and circuit breaking. The preview control plane is a separate WebSocket service for agent registration, routing, and policy-authorized delegation.
• crates/openab-mcp/src/mcp/runtime.rs
• crates/openab-mcp/src/mcp/facade.rs
• crates/openab-cp/src/server.rs
• crates/openab-cp/src/router.rs
State, Security, and Lifecycle
Configuration centralizes platform credentials, agent command, pool limits, and environment expansion. Persistent local storage supports auth/session-related data; secrets and trust checks form key security boundaries. Startup/shutdown hooks and cron jobs add operational automation outside message turns.
• crates/openab-core/src/config.rs
• crates/openab-core/src/secrets.rs
• crates/openab-core/src/trust.rs
• crates/openab-core/src/cron.rs
Deployment and Infrastructure
Container images package OpenAB with selected agent runtimes; Kubernetes deployment persists agent authentication under /data via PVC. Helm supports broker-plus-gateway deployment. AWS ECS/Fargate provisioning is managed by oabctl, including networking, IAM, S3, Cloud Map, API Gateway/VPC Link webhook ingress, and secrets.
• Dockerfile
• charts/openab/templates/deployment.yaml
• k8s/deployment.yaml
• operator/src/control_plane.rs
Main entry points: pool.rs ACP session pool · main.rs OpenAB executable · lib.rs Broker core · directives.rs Reply directives & formatting
Components 21
OpenAB Broker
Primary executable and reusable turn-routing core.
- OpenAB executable
src/main.rs - Broker core · Shared broker boundary for all OpenAB entrypoints.
crates/openab-core/src/lib.rs - Turn dispatch · Normalizes inbound events and routes by thread identity.
crates/openab-core/src/dispatch.rs - Bot turns
crates/openab-core/src/bot_turns.rs
Platform Adapters
Native and gateway-isolated chat integrations.
- Discord adapter
crates/openab-core/src/discord.rs - Slack adapter
crates/openab-core/src/slack.rs - Reply directives & formatting · Selects reply target and renders streamed markdown or media.
crates/openab-core/src/directives.rs - Standalone gateway · Protocol boundary for additional chat platforms.
crates/openab-gateway/src/main.rs - Gateway ACP server · Connects gateway platform events to OpenAB's ACP boundary.
crates/openab-gateway/src/adapters/acp_server.rs - Gateway platforms · Telegram plus LINE, Feishu, Google Chat, WeCom, and Teams integrations.
crates/openab-gateway/src/adapters/telegram.rs
Agent Runtime
ACP process, remote runtime, and native-agent execution paths.
- ACP session pool · Maintains one bounded, TTL-managed agent process per conversation thread.
crates/openab-core/src/acp/pool.rs - ACP stdio connection · Child-process stdio boundary between broker and local agents.
crates/openab-core/src/acp/connection.rs - Configured agent CLIs
crates/openab-core/src/adapter.rs - AWS AgentCore adapter · Replaces local CLI invocation with Bedrock AgentCore.
crates/openab-core/src/acp/agentcore.rs - Native Rust agent · Separately runnable agent with LLM, skills, and tools.
openab-agent/src/main.rs
Extensions
Tool runtime and delegated-agent control plane.
- MCP runtime · Agent-facing tools, OAuth/auth, Gmail, LLM access, and discovery.
crates/openab-mcp/src/mcp/runtime.rs - Control plane · Registers agents, routes requests, and authorizes delegation.
crates/openab-cp/src/server.rs
Operations
Security, lifecycle, and deployment concerns.
- Secrets & trust · Protects credentials and validates trusted interactions.
crates/openab-core/src/secrets.rs - Lifecycle automation · Startup, shutdown, and scheduled operational work.
crates/openab-core/src/cron.rs - Container & Kubernetes deployment · Packages OpenAB and persists agent authentication on PVC-backed storage.
k8s/deployment.yaml - ECS operator · Provisions Fargate networking, IAM, ingress, and secrets.
operator/src/control_plane.rs
Connections 24
- OpenAB executable → Broker core: hosts
- OpenAB executable → Discord adapter: runs
- OpenAB executable → Slack adapter: runs
- Discord adapter → Bot turns: normalizes events
- Slack adapter → Bot turns: normalizes events
- Bot turns → Turn dispatch: dispatches
- Turn dispatch → ACP session pool: routes by thread
- ACP session pool → ACP stdio connection: owns sessions
- ACP stdio connection → Configured agent CLIs: ACP over stdio
- ACP session pool → AWS AgentCore adapter: optional remote backend
- Native Rust agent → MCP runtime: uses tools
- Configured agent CLIs → MCP runtime: can access tools
- ACP session pool → Reply directives & formatting: streams output
- Reply directives & formatting → Discord adapter: edits and replies
- Reply directives & formatting → Slack adapter: edits and replies
- Gateway platforms → Standalone gateway: platform events
- Standalone gateway → Gateway ACP server: serves
- Gateway ACP server → Turn dispatch: WebSocket/ACP turns
- Broker core → Secrets & trust: uses credentials and trust
- Broker core → Lifecycle automation: runs hooks and jobs
- Control plane → ACP session pool: authorized delegation
- Container & Kubernetes deployment → OpenAB executable: deploys
- Container & Kubernetes deployment → Standalone gateway: deploys with broker
- ECS operator → Control plane: provisions service infrastructure