parse_pdf locally while the workflow executes over a streaming connection (no webhooks in the demo path). See Getting started for the minimal API flow first. Replace package install lines with asapi to match this documentation.
Prerequisites
- Python 3.10+
- An execution API API key
- The
asapipackage (install from PyPI, or editable from your monorepo) - Redis-backed SSE on the execution API side (required for interactive runs)
1. Clone and install
2. Environment
Copy.env.example to .env and set at least your API key and base URL. Names vary by demo; common variables are listed in Environment.
3. One-time agent upload
The demo ships an orchestration JSON (for exampleexample_agent.json). Upload it once so every developer shares the same graph:
python -m scripts.upload_orchestration example_agent.json.
The command writes an agent id file (for example .agent_id) consumed by the app.
4. Run the server
http://localhost:8080, send a message, and attach a PDF when the workflow should call parse_pdf.
5. Request path (conceptual)
- The browser posts chat input (and optional upload) to your FastAPI app.
- The app builds local tool handlers (for example
build_local_tool_handlersmappingparse_pdfto an async function). - It calls
client.set_tools(...)thenrun_agent(orexecute_agentand awaits the handle). - SSE delivers pauses for tools; the handler runs
parse_pdfon the server using the uploaded file and returns JSON text. - The final
AgentGraphRunStatusResponseis reduced to assistant text for the UI.
asapi: typically app/interactive_run.py, tools/parse_pdf.py, and app/main.py.
6. Dump tool and validator JSON (optional)
If your tenant is missingparse_pdf or an invoice validator referenced by the graph, some demos ship a CLI to print registration payloads:
--tools, --validators, and -o combined.json. Register the printed JSON in your product UI or automation.