Hi all,

The first item on the README roadmap is "FastAPI integration + hosted
deployment -- make it really easy to get Apache Burr in an app in
production without thinking about REST APIs".
 I'd like to work on it, and I'd like to check the shape with the list
before writing code.

Today every application writes its own service layer. The five demos the UI
server mounts (email-assistant, multi-modal-chatbot, streaming-fastapi,
deep-researcher, hello-world-counter) each have a server.py with their own
routes. email-assistant's, for example:

- rebuilds the application on every request with initialize_from(...,
resume_at_next_action=True)
- runs it to the next human-input step with halt_before/halt_after
- has one endpoint per human-input step (create, answer_questions,
provide_feedback) and one that returns the state

Most of that is the same from app to app, and the parts that are easy to
get wrong are left to each app: two requests for the same app_id at once,
which inputs the next step needs, and how much internal state goes back to
the client.

What I have in mind: the user passes Burr a function that builds the
application for an app_id (graph, persister, initialize_from) and the
points where it waits for input. Burr returns a FastAPI router that the
user mounts in their own app, with three routes:

- start a run and return its app_id
- take inputs for a run and run it to the next halt point
- return a run's next action, the inputs that action needs, and a view of
its state

Some properties of this shape:

- The router mounts into the user's own FastAPI app, so authentication
stays in the user's dependencies. It is not part of the tracking server,
which SECURITY.md describes as an unauthenticated local development tool.
- Actions already declare their inputs (optional_and_required_inputs), so
the router can check a request before running anything and say which inputs
are missing.
- The persister keeps state between requests. With the open PR #1056
(https://github.com/apache/burr/pull/1056), a second request that saves the
same step raises PersistenceConflictError, which the router can answer with
409.
- Responses return only app_id, sequence_id, the next action and its
inputs, unless the user passes a function that maps state to what the
client should see. Internal state doesn't leak by default.

If this sounds reasonable, I'll open an issue for it. I'll bring questions
back here as they come up while I work out the design.

Thanks,
Yongjun Hong

Reply via email to