Overview
Declare a typed conversation, project it onto roles, and run it.
Product overview
Put the conversation under a typed contract; let agents supply its content.
agentsparty is a Python library for multi-agent systems whose permitted conversation is known before execution. You declare roles, typed messages, choices, and loops as a protocol. The library projects that global protocol onto each role, then runs the resulting session in one process.
The protocol owns who speaks next, which roles learn about a choice, and when the session can end. A model, human, policy, script, or service handler fills a declared role without gaining permission to invent another route.
# requires: api-key
import agentsparty as ap
Reader, Writer = ap.roles('Reader', 'Writer')
shape = ap.patterns.request_reply(Reader, Writer)
session = ap.Session(
shape,
{
Writer: ap.Agent(
ap.model('openai:gpt-5.6-luna'),
'Reply in one sentence.',
),
},
)
answer = session.ask(
Reader,
shape.Ask('What makes a conversation typed?'),
expect=shape.Answer,
)
print(answer.text)The same protocol can bind deterministic replies in a test or a human at an approval point. Projection runs while the session is constructed, before a provider call, and rejects a role that would have to guess which branch became active.
Where it fits
Use agentsparty when the interaction shape is known in advance, role-local visibility matters, and a run must be bounded, observed, or resumed from recorded decisions. A simpler agent loop is a better fit when one model should discover the route from a tool catalogue. Use transport or workflow infrastructure when roles must run across hosts; agentsparty supplies an in-process protocol runtime, not distributed delivery.
The checks cover declared routes, projection, message decoding, participant conformance, protocol identity, and configured limits. They do not establish that model content is true, that a human will answer, or that an external write is safe to repeat.
Read next
Start
Install the package, run a typed exchange, and review the project's guarantees.
Guide
Understand protocols, projection, participants, sessions, replay, and tracing.
How-to
Test offline, embed a live run, or build the coding harness.
Reference
Look up notation, errors, terminology, extensions, examples, and the generated API.
Start with the Quickstart. Read Why protocol-first when deciding whether the model fits your system, and Guarantees and limitations before relying on it in a service.