Building blocks¶
The ready building blocks from modular_agents.composites, which implement the interfaces.
Agent¶
composed_agent ¶
ComposedAgent: a model plus a harness, owning one context that every run continues.
blueprint ¶
Blueprint: everything an agent is made of, so the same agent can run on its own or serve as another agent's tool.
Blueprint
dataclass
¶
AgentTool ¶
Bases: SpawnAgentTool
Any blueprint as a named tool. From the caller's side it is indistinguishable from a device button.
Loop¶
loop ¶
Budget¶
tree_budget ¶
TreeBudget: a budget whose spend is also charged to its ancestors.
Model¶
anthropic_model ¶
AnthropicModel: an EndpointModel that builds its own Anthropic endpoint (adapter + HTTP transport).
endpoint_model ¶
EndpointModel: one model name on one endpoint. Waits for capacity, calls the endpoint, fills in elapsed time and cost.
adapter_endpoint ¶
AdapterEndpoint: an endpoint made of a protocol adapter and a transport.
anthropic_adapter ¶
AnthropicAdapter: common representation <-> Anthropic Messages API.
http_transport ¶
HttpTransport: POSTs JSON to one URL. Streams are read as server-sent events.
scheduler ¶
SemaphoreScheduler: caps concurrent requests per endpoint and retries transient errors centrally.
playbook_model ¶
PlaybookModel: a fake model that follows a written playbook instead of thinking. No API, fully deterministic.
Tools¶
static_toolset ¶
StaticToolSet: a fixed list of tools.
combined_toolset ¶
CombinedToolSet: several tool sets and single tools, seen by the model as one.
spawn_agent ¶
spawn_agent: a sub-agent is just a tool that runs a fresh context through a harness and returns its final answer.
tool_helpers ¶
Events¶
transcript_bus ¶
guard_bus ¶
Context policy¶
live_status_policy ¶
LiveStatusPolicy: shows the model the devices' current state on every call, without storing it in the context.
Inbox¶
list_inbox ¶
ListInbox: an in-memory inbox for one agent.
Devices¶
device ¶
Simulated devices: plain Python objects whose @action methods become tools.
Device ¶
A toy piece of hardware. Its state lives here, outside any agent's context, so every agent sees the same world.
DeviceToolSet ¶
Bases: StaticToolSet
The actions of some devices. readonly=True gives a look-but-don't-touch view of the same devices.
action ¶
Marks a device method as a tool. Its docstring is the description, its parameters the input schema.