symfonic.agent.facade¶
facade ¶
Capability-composed Agent: one provider, optional behavior as capabilities.
Agent ¶
Agent(model_provider: Any, *, instructions: str | None = None, model: str | ModelConfig | None = None, tools: Sequence[Any] = (), result_policy: ResultPolicySettings | None = None, capabilities: Sequence[CapabilityConfig] = (), max_model_rounds: int | None = None, observe_provider_call: Callable[[object], None] | None = None)
Bases: AgentContinuationMixin, AgentInstrumentationMixin
A tool-capable agent with an optional receipt plan cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_provider
|
Any
|
Any object satisfying |
required |
instructions
|
str | None
|
The system prompt, used verbatim. |
None
|
tools
|
Sequence[Any]
|
A |
()
|
result_policy
|
ResultPolicySettings | None
|
Explicit native tool-result policy settings. |
None
|
capabilities
|
Sequence[CapabilityConfig]
|
Typed optional behavior; grants are separated before folding. |
()
|
max_model_rounds
|
int | None
|
Provider round limit; |
None
|
observe_provider_call
|
Callable[[object], None] | None
|
Optional local observer of a deep copy of each model-call message argument. Disabled by default; never exported. |
None
|
Construction has no effects (FAC-8); the first effect occurs in run().
Ordinary instances serve concurrent run/stream calls on one loop;
receipt instances cache one plan and the journal arbitrates claims (FAC-9).
It is not documented as safe to share across event loops.
Source code in src/symfonic/agent/facade.py
capabilities
property
¶
Names actually folded into this agent's invocation plan.
composition_manifest
property
¶
Payload-free attestation of the capability fold this agent retained.
close
async
¶
Release facade-owned resources. Idempotent, and never raises.
In W1 the facade owns nothing, so this only marks the instance closed.
It never closes anything the adopter passed in โ the provider outlives
the agent. An in-flight run() is allowed to finish; close()
does not cancel it (LIF-4).
Source code in src/symfonic/agent/facade.py
run
async
¶
run(prompt: str, *, attachments: Sequence[Attachment] = (), history: Sequence[Message] = (), state: Mapping[str, Any] | None = None, session_id: str = '', invocation: AgentInvocation | None = None, output_type: type[BaseModel] | None = None) -> AgentResult[Any]
Run one non-streaming turn.
history is how a stateless agent takes a second turn: the adopter
holds the transcript and passes result.messages back.
Source code in src/symfonic/agent/facade.py
stream ¶
stream(prompt: str, *, attachments: Sequence[Attachment] = (), history: Sequence[Message] = (), state: Mapping[str, Any] | None = None, session_id: str = '', invocation: AgentInvocation | None = None, output_type: type[BaseModel] | None = None) -> AsyncIterator[AgentEvent]
Run one streaming turn.
A plain def, not an async generator function, on purpose: an async
generator defers argument validation to the first __anext__, which
would surface a ConfigurationError after the caller believed the
stream had started. This validates eagerly and raises at the call site,
while async for event in agent.stream(...) still reads identically
(EVT-8).