inbox
inbox
¶
A2A task inbox — per-job persistent task queue.
Each running job has an inbox where other agents can deposit tasks. Tasks persist across sheet boundaries — the conductor saves them atomically with job state. When an A2A-enabled sheet starts, pending tasks are injected as context for the musician.
Task lifecycle: 1. Agent A submits a task targeting agent B (A2ATaskSubmitted event) 2. Conductor routes it to B's inbox (persisted, A2ATaskRouted event) 3. B's next A2A-enabled sheet receives the task as context 4. B processes the task and produces artifacts 5. B completes the task (A2ATaskCompleted event) or fails it (A2ATaskFailed) 6. Results route back to A's inbox
Tasks are identified by a UUID. Each task tracks its lifecycle state for observability and routing.
Classes¶
A2ATaskStatus
¶
Bases: str, Enum
Lifecycle state of an A2A task.
Attributes¶
PENDING
class-attribute
instance-attribute
¶
Task is waiting in the inbox for the target agent to pick up.
ACCEPTED
class-attribute
instance-attribute
¶
Target agent has picked up the task (injected into a sheet).
COMPLETED
class-attribute
instance-attribute
¶
Task was successfully completed with artifacts.
A2ATask
¶
Bases: BaseModel
A task in an agent's A2A inbox.
Immutable once created — status transitions produce new snapshots saved atomically with job state.
A2AInbox
¶
Per-job task inbox for A2A protocol.
The conductor maintains one inbox per running job. Tasks are added when other agents submit work, and consumed when the owning agent's A2A-enabled sheets execute.
Serialization: to_dict() / from_dict() for atomic
persistence with job state. The inbox is saved alongside
CheckpointState — same atomicity guarantees.
Usage::
inbox = A2AInbox(job_id="j1", agent_name="canyon")
# Route a task
task = inbox.submit_task(
source_job_id="j2",
source_agent="forge",
description="Review architecture for module X",
)
# Inject pending tasks into sheet context
context_text = inbox.render_pending_context()
# Mark tasks as accepted when injected
inbox.mark_accepted(task.task_id)
# Complete a task with results
inbox.complete_task(task.task_id, artifacts={"review": "..."})
Source code in src/marianne/daemon/a2a/inbox.py
Attributes¶
Functions¶
submit_task
¶
Add a new task to the inbox.
Called by the conductor when routing an A2ATaskSubmitted event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_job_id
|
str
|
Job ID of the requesting agent. |
required |
source_agent
|
str
|
Name of the requesting agent. |
required |
description
|
str
|
What needs to be done. |
required |
context
|
dict[str, Any] | None
|
Optional additional context. |
None
|
Returns:
| Type | Description |
|---|---|
A2ATask
|
The created task with a unique ID. |
Source code in src/marianne/daemon/a2a/inbox.py
get_task
¶
get_pending_tasks
¶
Get all tasks in PENDING status.
Used to inject pending work into the agent's next sheet.
Source code in src/marianne/daemon/a2a/inbox.py
mark_accepted
¶
Mark a task as accepted (injected into a sheet).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
str
|
The task to accept. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the task was found and transitioned, False otherwise. |
Source code in src/marianne/daemon/a2a/inbox.py
complete_task
¶
Mark a task as completed with optional artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
str
|
The task to complete. |
required |
artifacts
|
dict[str, Any] | None
|
Output artifacts from the completed work. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the task was found and completed, False otherwise. |
Source code in src/marianne/daemon/a2a/inbox.py
fail_task
¶
Mark a task as failed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
str
|
The task that failed. |
required |
reason
|
str
|
Why the task could not be fulfilled. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the task was found and failed, False otherwise. |
Source code in src/marianne/daemon/a2a/inbox.py
render_pending_context
¶
Render pending tasks as markdown context for sheet injection.
Produces a section that the musician reads to understand incoming A2A tasks. Injected as cadenza context on A2A-enabled sheets.
Returns:
| Type | Description |
|---|---|
str
|
Markdown string, or empty string if no pending tasks. |
Source code in src/marianne/daemon/a2a/inbox.py
to_dict
¶
Serialize for atomic persistence with job state.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict representation suitable for JSON serialization. |
Source code in src/marianne/daemon/a2a/inbox.py
from_dict
classmethod
¶
Restore from serialized state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dict from |
required |
Returns:
| Type | Description |
|---|---|
A2AInbox
|
Reconstructed inbox with all tasks. |