Apache Camel component and sample runtime for AG-UI protocol workflows.
This repository provides:
- A reusable Camel component (
agui:) for producer/consumer integration. - A protocol service runtime with JSON-RPC 2.0 request handling, SSE event streaming, and optional WebSocket scaffolding.
- Transport compatibility modes for both split endpoints (
/agui/rpc+/agui/stream/{runId}) and single-endpoint POST+SSE (/agui/agent). - Core AG-UI event model covering lifecycle, text, tool, state, and interrupt/resume events.
- In-memory session/state services with pluggable SPI interfaces.
- Optional persistence-backed session/state services via shared
camel-persistencebackends. - Extension hooks for soft integration with MCP/A2A ecosystems.
camel-ag-ui/
|- pom.xml
|- camel-ag-ui-component/
| `- src/main/java/io/dscope/camel/agui/
|- samples/
| `- ag-ui-yaml-service/
| |- src/main/java/io/dscope/camel/agui/samples/
| `- src/main/resources/routes/ag-ui-platform.camel.yaml
`- docs/
|- architecture.md
|- development.md
`- TEST_PLAN.md
AGUI Dojo integration guide for this sample:
samples/ag-ui-yaml-service/README.md
Dependency coordinates for consumers:
- Group:
io.dscope.camel - Artifact:
camel-ag-ui - Version: match your release (for example
1.1.0)
Current Central publish flow releases the root POM artifact:
io.dscope.camel:camel-ag-ui:1.1.0
Maven:
<dependency>
<groupId>io.dscope.camel</groupId>
<artifactId>camel-ag-ui</artifactId>
<version>1.1.0</version>
</dependency>Gradle (Groovy):
implementation 'io.dscope.camel:camel-ag-ui:1.1.0'Gradle (Kotlin):
implementation("io.dscope.camel:camel-ag-ui:1.1.0")If you publish module artifacts (installer --include-modules mode), module coordinates such as io.dscope.camel:camel-ag-ui-component:<version> can be used.
- Java 21+
- Maven 3.9+
mvn clean testRun persistence-specific tests:
# JDBC persistence tests (embedded Derby)
mvn -pl camel-ag-ui-component -Dtest=PersistentAgUiPersistenceJdbcTest test
# Redis persistence tests (requires reachable Redis)
mvn -pl camel-ag-ui-component -Dtest=PersistentAgUiPersistenceRedisTest -Dcamel.persistence.test.redis.uri=redis://localhost:6379 testConfiguration defaults are loaded from samples/ag-ui-yaml-service/src/main/resources/application.yaml; any JVM -D... system properties override those values at runtime.
Example override: mvn -DskipTests compile exec:java -Dagui.health.port=9080 -Dagui.rpc.port=9080
cd samples/ag-ui-yaml-service
mvn -DskipTests compile exec:javaRecommended from repository root (avoids accidental root-module exec:java execution):
mvn -f samples/ag-ui-yaml-service/pom.xml -DskipTests -Dexec.mainClass=io.dscope.camel.agui.samples.Main compile exec:javaJDBC mode (embedded Derby):
cd samples/ag-ui-yaml-service
mvn -DskipTests compile exec:java -Dcamel.persistence.enabled=true -Dcamel.persistence.backend=jdbc -Dcamel.persistence.jdbc.url=jdbc:derby:memory:agui;create=trueRedis mode:
cd samples/ag-ui-yaml-service
mvn -DskipTests compile exec:java -Dcamel.persistence.enabled=true -Dcamel.persistence.backend=redis -Dcamel.persistence.redis.uri=redis://localhost:6379Redis + JDBC dehydration mode (redis_jdbc):
mvn -DskipTests compile exec:java -Dcamel.persistence.enabled=true -Dcamel.persistence.backend=redis_jdbc -Dcamel.persistence.redis.uri=redis://localhost:6379 -Dcamel.persistence.jdbc.url=jdbc:derby:memory:agui;create=trueEnable optional WebSocket scaffold route:
mvn -DskipTests compile exec:java -Dagui.websocket.enabled=true -Dagui.websocket.path=/agui/ws| Method | URL | Purpose |
|---|---|---|
GET |
http://localhost:8080/health |
Health/liveness |
GET |
http://localhost:8080/diagnostics |
Runtime diagnostics |
GET |
http://localhost:8080/agui/ui |
Browser UI for manual RPC + SSE visualization |
POST |
http://localhost:8080/agui/rpc |
JSON-RPC protocol entrypoint |
POST |
http://localhost:8080/agui/agent |
Single-endpoint POST+SSE transport (Dojo-style clients) |
POST |
http://localhost:8080/agui/backend_tool_rendering |
Alias of /agui/agent for backend-tool-rendering clients |
GET |
http://localhost:8080/agui/stream/{runId} |
SSE event stream |
WS |
ws://localhost:8080/agui/ws |
Optional WebSocket scaffold route (-Dagui.websocket.enabled=true) |
- Send JSON-RPC calls to
POST /agui/rpc - Read events from
GET /agui/stream/{runId}
- Send JSON-RPC calls to
POST /agui/agent - Receive
text/event-streamresponse in the same HTTP call
Example:
curl -N -X POST http://localhost:8080/agui/agent \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"run.start","params":{"runId":"dojo-run","sessionId":"dojo-session"}}'Expected response stream includes events such as run.started and step.started.
Current sample emits uppercase AG-UI event names (for example RUN_STARTED, STEP_STARTED).
Persistence is disabled by default. Enable it with system properties:
-Dcamel.persistence.enabled=true
-Dcamel.persistence.backend=redis|jdbc|redis_jdbc|ic4jCommon persistence properties:
camel.persistence.snapshot-every-events(default25)camel.persistence.max-replay-events(default500)
Redis backend properties:
camel.persistence.redis.uri(defaultredis://localhost:6379)camel.persistence.redis.key-prefix(defaultcamel:state)
JDBC backend properties:
camel.persistence.jdbc.url(example:jdbc:derby:memory:agui;create=true)camel.persistence.jdbc.usercamel.persistence.jdbc.password
Redis-JDBC backend behavior (camel.persistence.backend=redis_jdbc):
- rehydrate path reads Redis first, then falls back to JDBC and warms Redis
- append/snapshot writes use JDBC as source-of-truth and update Redis best-effort
run.startrun.texttool.callstate.updaterun.interruptrun.resumerun.finishhealth
agui:agentId[?options]
Options:
agentIdserverUrlremoteUrlrpcPathstreamPathallowedOriginssendToAllwebsocketEnabledwsPathprotocolVersion
Apache License 2.0.