jeevesagent.core.types¶
Pydantic types for messages, events, tools, memory, and runtime state.
These are the value objects that flow across module boundaries. They are immutable where possible, validated on construction, and free of behavior that requires I/O.
Classes¶
An immutable, signed entry in the audit log. |
|
Result of a budget check before each step. |
|
A value carrying provenance metadata for freshness/lineage checks. |
|
A single (input, decisions, tool calls, output) tuple from history. |
|
A single observable record from a running session. |
|
Enum where members are also (and must be) strings |
|
A semantic claim extracted from one or more episodes. |
|
An in-context memory block, pinned to every prompt. |
|
A single chat message in the model's conversation. |
|
A single chunk from a streaming model call. |
|
Outcome of a permission check or pre-tool hook. |
|
Enum where members are also (and must be) strings |
|
Final outcome of an |
|
A trace span handle. Concrete telemetry adapters return their own |
|
A model-emitted request to invoke a tool. |
|
Schema description of a tool the model can call. |
|
Tool registry change notification (MCP listChanged etc.). |
|
Outcome of a tool invocation. |
|
Token and cost accounting for a model call. |
Module Contents¶
- class jeevesagent.core.types.AuditEntry(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelAn immutable, signed entry in the audit log.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- timestamp: datetime.datetime¶
- class jeevesagent.core.types.BudgetStatus(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelResult of a budget check before each step.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod blocked_(reason: str) BudgetStatus[source]¶
- classmethod ok_() BudgetStatus[source]¶
- classmethod warn_(reason: str) BudgetStatus[source]¶
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- state: Literal['ok', 'warn', 'blocked']¶
- class jeevesagent.core.types.CertifiedValue(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA value carrying provenance metadata for freshness/lineage checks.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- fetched_at: datetime.datetime¶
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- valid_until: datetime.datetime | None = None¶
- value: Any¶
- class jeevesagent.core.types.Episode(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA single (input, decisions, tool calls, output) tuple from history.
user_idis the framework-managed namespace partition. Episodes persisted with oneuser_idvalue are never visible to memory recall queries scoped to a differentuser_id.Noneis its own bucket — the “anonymous / single-tenant” namespace — and does not see episodes belonging to a non-Noneuser_id(and vice versa). Set automatically fromRunContextby the agent loop; pass explicitly when constructing episodes outside a run.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- occurred_at: datetime.datetime = None¶
- class jeevesagent.core.types.Event(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA single observable record from a running session.
Carries a discriminator (
kind) plus a free-form payload. Construct via the class methods to ensure consistent shapes.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod architecture_event(session_id: str, name: str, **data: Any) Event[source]¶
Generic architecture-progress event.
nameis a namespaced string identifying the source architecture and the kind of progress (e.g."self_refine.critique","reflexion.lesson_persisted","router.classified").datais merged into the payload alongsidenameso consumers can pattern-match onnameand read structured fields off the rest.
- classmethod budget_exceeded(session_id: str, status: BudgetStatus) Event[source]¶
- classmethod budget_warning(session_id: str, status: BudgetStatus) Event[source]¶
- classmethod error(session_id: str, exc: BaseException) Event[source]¶
- classmethod model_chunk(session_id: str, chunk: ModelChunk) Event[source]¶
- classmethod tool_result(session_id: str, result: ToolResult) Event[source]¶
- at: datetime.datetime = None¶
- class jeevesagent.core.types.EventKind[source]¶
Bases:
enum.StrEnumEnum where members are also (and must be) strings
Initialize self. See help(type(self)) for accurate signature.
- ARCHITECTURE_EVENT = 'architecture_event'¶
Generic architecture-progress event. Carries a namespaced
namein the payload (e.g."self_refine.critique","reflexion.lesson_persisted","router.classified") so each architecture can stream its own progress signal without expandingEventKind.
- BUDGET_EXCEEDED = 'budget_exceeded'¶
- BUDGET_WARNING = 'budget_warning'¶
- COMPLETED = 'completed'¶
- ERROR = 'error'¶
- MEMORY_RECALL = 'memory_recall'¶
- MEMORY_WRITE = 'memory_write'¶
- MODEL_CHUNK = 'model_chunk'¶
- PERMISSION_ASK = 'permission_ask'¶
- PERMISSION_DECISION = 'permission_decision'¶
- STARTED = 'started'¶
- TOOL_CALL = 'tool_call'¶
- TOOL_RESULT = 'tool_result'¶
- class jeevesagent.core.types.Fact(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA semantic claim extracted from one or more episodes.
Bi-temporal:
valid_from/valid_untiltracks when the fact was true in the world;recorded_attracks when we learned it.user_idis the framework-managed namespace partition. Facts persisted with oneuser_idvalue are never visible to recall queries scoped to a differentuser_id. Set automatically fromRunContextby the agent loop / consolidator; pass explicitly when constructing facts outside a run.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- recorded_at: datetime.datetime = None¶
- valid_from: datetime.datetime = None¶
- valid_until: datetime.datetime | None = None¶
- class jeevesagent.core.types.MemoryBlock(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelAn in-context memory block, pinned to every prompt.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- updated_at: datetime.datetime = None¶
- class jeevesagent.core.types.Message(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA single chat message in the model’s conversation.
tool_callsis populated on assistant messages that emitted tool calls in the previous turn — real provider adapters (Anthropictool_useblocks, OpenAItool_callsarray) need to reconstruct the right wire format from this.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jeevesagent.core.types.ModelChunk(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA single chunk from a streaming model call.
Discriminated by
kind. Exactly one of the optional fields is set depending on the kind.Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- kind: Literal['text', 'tool_call', 'finish']¶
- class jeevesagent.core.types.PermissionDecision(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelOutcome of a permission check or pre-tool hook.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod allow_(reason: str | None = None) PermissionDecision[source]¶
- classmethod ask_(reason: str | None = None) PermissionDecision[source]¶
- classmethod deny_(reason: str) PermissionDecision[source]¶
- decision: Literal['allow', 'deny', 'ask']¶
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jeevesagent.core.types.Role[source]¶
Bases:
enum.StrEnumEnum where members are also (and must be) strings
Initialize self. See help(type(self)) for accurate signature.
- ASSISTANT = 'assistant'¶
- SYSTEM = 'system'¶
- TOOL = 'tool'¶
- USER = 'user'¶
- class jeevesagent.core.types.RunResult(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelFinal outcome of an
Agent.runcall.outputis always the raw assistant text (the JSON itself when a structured-output schema was supplied).parsedis the validated Pydantic instance — populated only when the caller passedoutput_schema=toAgent.run(). Use whichever fits the call site:# free-form text run result = await agent.run("summarise this PDF") print(result.output) # structured-output run result = await agent.run(prompt, output_schema=Invoice) invoice: Invoice = result.parsed # typed, validated
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- property duration: datetime.timedelta¶
Wall-clock latency between
started_atandfinished_at.
- finished_at: datetime.datetime¶
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- parsed: Any | None = None¶
The validated Pydantic instance when
output_schema=was supplied toAgent.run();Noneotherwise. Typed asAnyto keep the runtime type free; the call site has the schema and can cast or annotate as needed.
- started_at: datetime.datetime¶
- class jeevesagent.core.types.Span(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA trace span handle. Concrete telemetry adapters return their own representation; this is the value-object contract for in-process use.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- started_at: datetime.datetime = None¶
- class jeevesagent.core.types.ToolCall(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA model-emitted request to invoke a tool.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class jeevesagent.core.types.ToolDef(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelSchema description of a tool the model can call.
Mirrors the JSON-Schema-flavored shape used across MCP and provider APIs.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class jeevesagent.core.types.ToolEvent(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelTool registry change notification (MCP listChanged etc.).
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- at: datetime.datetime = None¶
- kind: Literal['added', 'removed', 'updated']¶
- class jeevesagent.core.types.ToolResult(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelOutcome of a tool invocation.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod denied_(call_id: str, reason: str, **kwargs: Any) ToolResult[source]¶
- classmethod error_(call_id: str, message: str, **kwargs: Any) ToolResult[source]¶
- classmethod success(call_id: str, output: Any, **kwargs: Any) ToolResult[source]¶
- output: Any = None¶
- started_at: datetime.datetime = None¶
- class jeevesagent.core.types.Usage(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelToken and cost accounting for a model call.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].