kaboo_workflows.adapters¶
The serving layer: turn a resolved config into an AG-UI / CopilotKit app.
kaboo_workflows.adapters ¶
AG-UI adapter for kaboo-workflows.
create_agui_app ¶
create_agui_app(
config_path,
*,
endpoint="/invocations",
ping_path="/ping",
cors_origins=None,
cors_allow_credentials=True,
auth=None,
session_config_key=None,
allowed_mcp_hosts=None,
)
Create a FastAPI app serving AG-UI SSE from a YAML config.
By default the process serves one config: it is loaded here, its agents are built once, and every run uses them.
Setting session_config_key makes the service behave like a function
instead. Each run submits its own config in forwardedProps under that key,
layered over config_path as an overlay (see
:func:~kaboo_workflows.config.load_session_config), and gets its own agents,
orchestration, entry and MCP client sessions, all released when the run ends.
Different runs can then be different workflows, and a restart or a second
replica behaves like a cold instance because nothing is kept between runs.
That is only safe because conversation state does not live in the objects
being rebuilt: history and pending interrupts arrive with each turn on the
AG-UI state channel (see
:class:~kaboo_workflows.hooks.SessionStateHook).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | Path
|
Path to the kaboo-workflows YAML config. With
|
required |
endpoint
|
str
|
Path for the AG-UI agent endpoint. |
'/invocations'
|
ping_path
|
str | None
|
Path for the health check endpoint. |
'/ping'
|
cors_origins
|
list[str] | None
|
Allowed CORS origins. Defaults to |
None
|
cors_allow_credentials
|
bool
|
Whether to allow credentialed CORS requests. |
True
|
auth
|
AuthVerifier | None
|
Optional inbound auth verifier. Receives each |
None
|
session_config_key
|
str | None
|
|
None
|
allowed_mcp_hosts
|
list[str] | None
|
Hosts a submitted config's MCP client URL may point at. Set this whenever configs are authored anywhere but this repository: an arbitrary URL needs no code to exfiltrate. |
None
|
Returns:
| Type | Description |
|---|---|
FastAPI
|
A FastAPI application with AG-UI SSE streaming. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the entry node is an unsupported orchestration type. |
Source code in src/kaboo_workflows/adapters/agui.py
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | |