Plug that receives A2A JSON-RPC requests over HTTP.
Mount in your router:
forward "/a2a", A2aEngine.Transport.Http.Plug,
handler: MyApp.A2A.Handler,
auth: A2aEngine.Auth.Bearer,
auth_opts: [tokens: %{"secret" => "my-agent"}]Behaviour
- POST
/— unary JSON-RPC. Returns 200 with JSON-RPC response envelope, or 401 / 400 on auth / decode failure. - POST
/withAccept: text/event-streamAND a method in the streaming set (message/stream,tasks/resubscribe) — responds with SSE chunks. Each event frame followsA2aEngine.Codec.SSE. - Any other path or method → 404.
Host must have already parsed the JSON body (e.g. via Plug.Parsers
mounted upstream). The plug reads conn.body_params.
Options
:handler— required. Module implementingA2aEngine.Handler.:auth— required. Module implementingA2aEngine.Auth.:auth_opts— keyword list passed to the auth module.
Summary
Functions
Whether a method is one of the A2A streaming methods that this plug
will respond to with an SSE stream (provided the client sends
Accept: text/event-stream).