AI and Bot Integration Guide
This guide is written for automation engineers building bots and AI assistants on top of Buzen ESB. It defines deterministic behavior so generated routes and API call sequences remain safe and production-usable.
1. Non-negotiable rules for agents
- Authenticate before any management API write call.
- Parse the response envelope and branch on success.
- For app route upsert endpoints, submit exactly one route per file/content.
- Always include explicit route ID and ensure it matches target route ID.
- Never bind ingress paths under reserved internal prefixes.
- Treat .bar + buzen.json as canonical deployable artifact.
- Validate payloads against provided schemas before submit.
2. Recommended output profiles
Route YAML profile
- route:
id: <route-id>
from:
uri: "<source-uri>"
steps:
- <step-type>:
<step-config>
Manifest profile
{
"name": "<app-name>",
"version": "1.0.0",
"routes": [
{ "file": "routes/<route-id>.yaml", "autoStart": true }
]
}
Use explicit route files under routes/ and avoid multi-route documents for bot-generated updates.
3. Deterministic API sequences
Deploy archive
- Login
- POST /api/v1/apps multipart upload
- GET /api/v1/apps/{appId}
- GET /api/v1/apps/{appId}/routes
Create empty app and add first route
- Login
- POST /api/v1/apps JSON create shell
- POST /api/v1/apps/{appId}/routes route upsert
- Read back content endpoint for verification
Safe route update
- Fetch current route content
- Generate new single-route YAML with same route ID
- Submit PUT /api/v1/apps/{appId}/routes/{routeId}/content
- On failure, parse envelope and decide retry/rollback
Route duplication with ingress conflicts
- Read duplicate capabilities endpoint
- Choose FAIL, AUTO_RENAME, or MANUAL strategy
- Submit duplicate request with conflict policy
- If 409, parse conflicts and retry with explicit remaps
4. Source-first validation
Use source-synced contracts first, then compatibility schemas for payload shaping.
- source-snapshot.json (active source commit + runtime versions)
- management-endpoints.json (controller-derived endpoint map)
- Runtime OpenAPI: /api-docs and /swagger-ui.html
- Compatibility profile: buzen-archive-manifest.schema.json
- Compatibility profile: app-route-upsert-request.schema.json
- Compatibility profile: app-route-duplicate-request.schema.json
- Compatibility profile: buzen-flow-designer-route.schema.json
Schema pass is necessary but not sufficient. Runtime checks still enforce route ID uniqueness, ingress safety, and dependency constraints.
5. Error branching logic for bots
if HTTP 400 -> fix payload and retry
if HTTP 401 -> re-authenticate
if HTTP 403 -> escalate role error
if HTTP 404 -> verify appId/routeId
if HTTP 409 -> resolve conflict then retry
if HTTP 500 -> bounded retry with backoff, then escalate
Always record request IDs, app IDs, and route IDs in bot logs for replay and audit.
6. Prompt template for route generation
Generate a Buzen ESB route for app <appId>.
Constraints:
- Single route per file.
- Explicit route.id = <routeId>.
- YAML follows canonical route/from/steps shape.
- Do not bind ingress under /api/v1, /actuator, /console, /api-docs, /swagger-ui.
- Prefer dataSourceRef for DB access.
- Provide matching AppRouteUpsertRequest payload.
Full AI reference: ai-playbook.md