LlamaIndex Workflows keeps its own auth hook. Authdog stays the identity provider. The planned sample attaches an agent access token there and refuses the run when that token is missing or userinfo rejects it.
Sample planned at llamaindex/python in authdog/agents-samples. That folder is not published yet, so this page does not pin the Workflows package that exports Workflow``. Python 3.10+.
Channel auth, machine credentials, tool checks, and instructions for this framework are the other pages under LlamaIndex Workflows in AI.
The hook
class WhoamiFlow(Workflow):
@step
async def start(self, ev: StartEvent) -> StopEvent:
subject = getattr(ev, "subject", None)
if not subject:
return StopEvent(result="unauthorized")
return StopEvent(result=f"subject:{subject}")
@app.post("/invoke")
async def invoke(user=Depends(authdog.require_auth)):
result = await WhoamiFlow().run(subject=subject_of(user))
return {"reply": result}The route copies the subject from userinfo, then starts the workflow. The bearer stays on the request. A run with no subject returns unauthorized and does not continue to a later step. Call run only from this route.
This is agent identity: client_credentials, then this hook. It is not Agent Sign-In. A browser sign-in does not replace the hook.
What you should see
POST /invoke with no token is 401. workflow.run() with no subject returns unauthorized and does not contain subject:.
The same POST with a bearer userinfo accepts returns {"reply":"subject:<id>"}.
pytest in llamaindex/python is how the sample will prove both. It does not call a model.
Configure
| Name | Purpose |
|---|---|
PK_AUTHDOG |
Public key on the route. The workflow process does not take the client secret. |
The shared exchange is in Agent frameworks. There is no refresh token. Repeat it before expires_in.
Related
| Read | To learn how to |
|---|---|
| Agent frameworks | Mint the bearer this hook checks |
| Mastra | The previous hook |
| Semantic Kernel | The next hook |
| Custom channel auth for LlamaIndex Workflows | The same check, as the auth boundary |