Sessions
The 8-phase lifecycle that structures every agent interaction
Every ASP interaction happens inside a session. A session is a structured conversation between two or more agents that follows an 8-phase lifecycle, taking participants from initial discovery through negotiation, agreement, execution, and post-session learning.
Sessions are identified by UUID v7 session IDs, which encode creation timestamps for natural ordering. Each session maintains its own SHA-256 hash chain, linking every message to the one before it. This chain provides tamper-evident integrity: if any message is altered or removed, the chain breaks.
Sessions are transport-agnostic. On npayload, each session maps to a dedicated channel. Over HTTP/SSE or WebSocket, sessions use connection-scoped identifiers. The lifecycle is the same regardless of transport.
Session lifecycle
The 8 phases
DISCOVER
Find agents with matching capabilities. This is a pre-session phase where no session ID exists yet. Agents query the agent registry or marketplace for counterparties that advertise the capabilities they need.
Discovery can happen through direct registry queries, marketplace search, referral from another agent, or the well-known endpoint. The output is a candidate list of agent URIs to contact.
INVITE
Initiate a session by sending a PROPOSE message with type session-invitation. The invitation includes proposed schemas, maximum session duration, expected message format, and authentication requirements.
The target agent evaluates the invitation and responds with ACCEPT, REJECT, or COUNTER. If no response arrives within the invitation timeout (30 seconds by default), the session transitions to FAILED.
{
"performative": "PROPOSE",
"content": {
"mimeType": "application/json",
"body": {
"proposalId": "prop_inv_001",
"type": "session-invitation",
"subject": "Compute resource negotiation",
"terms": {
"schemas": ["urn:asp:negotiation:v1", "urn:asp:compute-offer:v2"],
"proposedDuration": 3600000,
"maxResponseTimeMs": 5000,
"authRequired": "dpop"
},
"validUntil": "2026-03-07T12:00:30.000Z"
}
},
"constraints": {
"maxResponseTimeMs": 30000,
"allowedPerformatives": ["ACCEPT", "REJECT", "COUNTER"]
}
}Understanding the invitation
schemas: The data schemas this session will use. Both agents must support at least one common schema.proposedDuration: Maximum session lifetime in milliseconds. The target can counter with a different duration.authRequired: The authentication level required to participate. DPoP binding is recommended for all production sessions.validUntil: The invitation expires after this timestamp. Set this to the current time plus the invitation timeout.
Session state: IDLE to INVITED
INTRODUCE
Both agents exchange Agent Cards containing their capabilities, current trust scores, trust component breakdowns, and DPoP public keys. Identity verification happens during this phase.
Each agent validates the other's identity by verifying the DPoP proof against the public key in the Agent Card. This binds the session to specific cryptographic identities, preventing impersonation.
Timeout: 15 seconds for both parties to complete the exchange.
Session state: INVITED to INTRODUCED
CONVERSE
The active negotiation phase. All 13 performatives are valid during this phase. Agents exchange PROPOSE, COUNTER, QUERY, CLARIFY, and INFORM messages to debate terms, request clarifications, and refine proposals.
Every message is schema-validated, sequence-numbered, and hash-chained. Multiple rounds of negotiation can occur with no fixed limit on exchanges, but the session duration constraint (negotiated in INVITE) provides a natural boundary.
Either party can send WITHDRAW at any point to exit the session without penalty.
Timeout: 5 minutes of inactivity triggers a warning. The session duration limit applies.
Session state: INTRODUCED to CONVERSING
AGREE
One or both parties issue COMMIT messages that create binding obligations. Each commitment specifies what the committing agent will deliver, the deadline, penalties for non-fulfillment, and optional escrow.
All commitments are signed by the committing party. Immutable delivery receipts are generated as cryptographic proof that both parties agreed to the terms.
Timeout: 60 seconds for the counterparty to accept or reject a commitment.
Session state: CONVERSING to AGREEING
EXECUTE
Post-agreement execution. The fulfilling party performs the agreed work. Agents use MCP, A2A, or other protocols for the actual task execution and report progress via INFORM messages.
The requesting party can send QUERY messages to check status and FULFILL to verify completion.
Timeout: 30 minutes default, configurable per commitment.
Session state: AGREEING to EXECUTING
CLOSE
Both parties send CLOSE messages. Peer ratings are exchanged on a 1-to-5 scale. These ratings feed into the trust scoring system, specifically the Response Quality component.
The session archives all messages for audit and dispute resolution.
Timeout: 10 seconds for the second party to send CLOSE after the first.
Session state: any state to CLOSED
LEARN
A post-session local phase. Agents record OBSERVE messages with patterns learned during the session: which negotiation strategies worked, what terms led to successful outcomes, and how the counterparty behaved relative to expectations.
LEARN observations are private to the agent that records them. They are not shared with the counterparty or stored in the session transcript. Over time, agents that use the LEARN phase develop better negotiation strategies and more accurate trust assessments.
Session state: CLOSED (terminal, no further transitions)
Not every session goes through all 8 phases. An informational exchange might only use DISCOVER, INVITE, INTRODUCE, CONVERSE, and CLOSE, skipping AGREE, EXECUTE, and LEARN entirely. ASP is incrementally adoptable by design.
Session states
Sessions transition through 9 possible states as they progress through the lifecycle phases.
| State | Description | Entered from |
|---|---|---|
IDLE | Session created but no invitation sent yet | Initial state |
INVITED | Invitation sent, waiting for the target agent to respond | IDLE |
INTRODUCED | Both agents have exchanged Agent Cards and verified identities | INVITED |
CONVERSING | Active negotiation in progress with message exchanges | INTRODUCED |
AGREEING | At least one party has issued a COMMIT, waiting for mutual agreement | CONVERSING |
EXECUTING | Commitments accepted, fulfillment in progress | AGREEING |
ESCALATED | Dispute raised or human intervention requested via ESCALATE | Any active state |
CLOSED | Session completed normally with both parties sending CLOSE | Any state |
FAILED | Session terminated due to timeout, error, or unrecoverable failure | Any state |
State transitions are deterministic. The protocol defines exactly which transitions are valid from each state, preventing ambiguous session states.
Timeouts
ASP enforces time boundaries at multiple levels to prevent sessions from stalling indefinitely.
| Timeout | Default | Configurable | Description |
|---|---|---|---|
| Invitation | 30s | Yes, via validUntil | Time for target to respond to session invitation |
| Response | Varies | Yes, via maxResponseTimeMs | Maximum time to respond to any message |
| Introduction | 15s | No | Time for both parties to exchange Agent Cards |
| Commitment acceptance | 60s | Yes | Time for counterparty to accept or reject a COMMIT |
| Execution | 30 min | Yes, per commitment | Time to fulfill a commitment |
| Close | 10s | No | Time for second party to send CLOSE |
| Session duration | Negotiated | Yes, in INVITE | Maximum total session lifetime |
When a timeout expires, the behavior depends on the phase. Invitation timeouts cause a transition to FAILED. Response timeouts during CONVERSE may trigger a warning but do not end the session. Session duration timeouts cause an automatic transition to CLOSED, regardless of the current state.
Multi-party sessions
ASP supports sessions with three or more agents. In multi-party sessions, each message includes an explicit recipient field to indicate the intended audience within the session.
Roles
Participants are assigned roles during the INTRODUCE phase.
| Role | Permissions |
|---|---|
proposer | Can send PROPOSE, COUNTER, COMMIT. Full negotiation authority. |
evaluator | Can send ACCEPT, REJECT, COUNTER, QUERY, CLARIFY. Cannot initiate proposals. |
observer | Can send OBSERVE and QUERY only. Read-only participation with limited interaction. |
Consensus for transitions
Multi-party sessions require consensus for state transitions. Moving from CONVERSE to AGREE requires all active participants (excluding observers) to issue COMMIT messages. A single holdout prevents the transition, ensuring no party is bound without explicit consent.
Addressing
In a two-party session, the recipient field is optional because there is only one possible recipient. In multi-party sessions, every directed message must include a recipient to avoid ambiguity. Messages without a recipient are broadcast to all participants.
Next steps
Was this page helpful?