Agent
junjo.agent.definition.Agent
Kind: Class
SDK version: 0.67.0
Documentation channel: Stable release
Signature
Section titled “Signature”Agent(*, key: str, name: str, instructions: str, input_type: TypeForm[InputT], model: ModelDriverBinding, tools: Sequence[Tool[Any, Any, DependenciesT]], output_type: TypeForm[OutputT], limits: AgentLimits | None = None, hooks: Hooks | None = None)A reusable typed Agent definition with isolated bounded executions.
Constructor
Section titled “Constructor”Declare one immutable, reusable Agent definition.
Construction validates all boundary schemas and computes the language-neutral structural fingerprint. It does not create a driver, Store, span, or run identity.
Parameters
Section titled “Parameters”| Name | Type | Description | Default |
|---|---|---|---|
key |
str |
Stable application-owned semantic key. | |
name |
str |
Human-readable span and diagnostic name. | |
instructions |
str |
Exact provider-neutral instructions. | |
input_type |
TypeForm[InputT] |
Pydantic-compatible input boundary type. | |
model |
ModelDriverBinding |
Descriptor plus shared driver or per-run factory. | |
tools |
Sequence[Tool[Any, Any, DependenciesT]] |
Ordered Tool definitions available to the model. | |
output_type |
TypeForm[OutputT] |
Pydantic-compatible successful output type. | |
limits |
AgentLimits | None |
Positive per-execution limits; defaults are explicit. | None |
hooks |
Hooks | None |
Optional lifecycle observers. Hooks do not own execution. | None |
Raises
Section titled “Raises”| Exception | Description |
|---|---|
AgentConfigurationError |
If any declaration is invalid. |
Members
Section titled “Members”key: strPublic attribute.
name: strPublic attribute.
instructions
Section titled “instructions”instructions: strPublic attribute.
definition_id
Section titled “definition_id”definition_id: strPublic attribute.
structural_id
Section titled “structural_id”structural_id: strPublic attribute.
input_schema
Section titled “input_schema”input_schema: Mapping[str, FrozenJsonValue]Public attribute.
output_schema
Section titled “output_schema”output_schema: Mapping[str, FrozenJsonValue]Public attribute.
input_adapter
Section titled “input_adapter”input_adapter: TypeAdapter[InputT]Public attribute.
output_adapter
Section titled “output_adapter”output_adapter: TypeAdapter[OutputT]Public attribute.
model: ModelDriverBindingPublic attribute.
tools: tuple[Tool[Any, Any, DependenciesT], ...]Public attribute.
limits
Section titled “limits”limits: AgentLimitsPublic attribute.
hooks: Hooks | NonePublic attribute.
structural_material
Section titled “structural_material”structural_material() -> dict[str, object]Return the exact pre-policy material used for this fingerprint.
definition_snapshot
Section titled “definition_snapshot”definition_snapshot() -> dict[str, object]Return schema-versioned diagnostic definition evidence.
execute
Section titled “execute”execute(input: InputT, *, dependencies: DependenciesT, history: Sequence[AgentMessage] = (), correlation: ExecutionCorrelation | None = None) -> AgentExecutionResult[OutputT]Execute one isolated run against detached typed boundaries.
Parameters
Section titled “Parameters”| Name | Type | Description | Default |
|---|---|---|---|
input |
InputT |
Value validated against input_type. |
|
dependencies |
DependenciesT |
Opaque application-owned services passed only to Tool contexts. |
|
history |
Sequence[AgentMessage] |
Complete prior normalized exchanges. Junjo does not persist history between calls. |
() |
correlation |
ExecutionCorrelation | None |
Optional trusted application identity for this execution tree. Nested Junjo executables inherit it and cannot replace it. |
None |
Returns
Section titled “Returns”AgentExecutionResult[OutputT]: A detached successful result whose output isOutputT.
Raises
Section titled “Raises”| Exception | Description |
|---|---|
AgentInvocationError |
If admission boundaries are invalid. |
AgentExecutionError |
If admitted execution fails. |
asyncio.CancelledError |
If the caller cancels active work. |