Skip to content

Agent

junjo.agent.definition.Agent

Kind: Class

SDK version: 0.67.0

Documentation channel: Stable release

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)

View source

A reusable typed Agent definition with isolated bounded executions.

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.

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
Exception Description
AgentConfigurationError If any declaration is invalid.

key: str

View source

Public attribute.

name: str

View source

Public attribute.

instructions: str

View source

Public attribute.

definition_id: str

View source

Public attribute.

structural_id: str

View source

Public attribute.

input_schema: Mapping[str, FrozenJsonValue]

View source

Public attribute.

output_schema: Mapping[str, FrozenJsonValue]

View source

Public attribute.

input_adapter: TypeAdapter[InputT]

View source

Public attribute.

output_adapter: TypeAdapter[OutputT]

View source

Public attribute.

model: ModelDriverBinding

View source

Public attribute.

tools: tuple[Tool[Any, Any, DependenciesT], ...]

View source

Public attribute.

limits: AgentLimits

View source

Public attribute.

hooks: Hooks | None

View source

Public attribute.

structural_material() -> dict[str, object]

View source

Return the exact pre-policy material used for this fingerprint.

definition_snapshot() -> dict[str, object]

View source

Return schema-versioned diagnostic definition evidence.

execute(input: InputT, *, dependencies: DependenciesT, history: Sequence[AgentMessage] = (), correlation: ExecutionCorrelation | None = None) -> AgentExecutionResult[OutputT]

View source

Execute one isolated run against detached typed boundaries.

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
  • AgentExecutionResult[OutputT]: A detached successful result whose output is OutputT.
Exception Description
AgentInvocationError If admission boundaries are invalid.
AgentExecutionError If admitted execution fails.
asyncio.CancelledError If the caller cancels active work.