Signed-out Session lifecycle
A signed-out Session gives the company a stable, pairwise context before the
user shares account identity. The Session can support public questions and a
conversation that later continues through sign-in. A Session is local:
SessionClient.start makes a PapSession with a random sid and asks the
company nothing. The company meets the Session on its first request, and the
Poppy-Session header of every request names it.
What the example proves​
- Starting a Session sends no request. The Session is signed out until a request carries an access token.
- Every request carries a new Session JWT, with a new
jti, for the samesid. session_endedmeans the company ended the Session (§5.5). The client starts a new Session once, with a newsid, and sends the request again in it.- A second
session_endedstops there: the refusal goes to the caller. invalid_sessionmeans the header failed a check (§5.3): a new Session would fail the same way, so the refusal goes to the caller at once, to fix its cause.- The User ID and the delegated key stay the same across a restart.
- Session IDs, pairwise subjects, Session JWTs, delegations, and keys stay inside host-owned code and protected storage.
- The model sees only lifecycle status and safe invariants.
To end a Session without signing out, the agent stops using its sid. Its refresh
tokens are unaffected.
The deterministic company transport answers session_ended on chosen requests,
so the restart path is always exercised. Production code uses the same
SessionClient and SessionHttpClient with real HTTPS and managed Reactor
contributions.
Run the Pydantic AI example or the Agent Runtimes example. Continue with the complete Direct Sign-In lifecycle.