Skip to main content

agent

Core agent runtime implementing the decide-act-observe workflow loop on Temporal. This package defines the agent workflow, all activities, decision logging, cost tracking, and trace persistence.

Used by cmd/worker, cmd/run, cmd/ui, cmd/temporal-agent.

Usage

import "cruvero/internal/agent"

Key Types / Interfaces

TypeSourceDescription
AgentRunInputtypes.goWorkflow input: config, state, tool registry ref, memory refs
AgentRunResulttypes.goWorkflow output: final state and decision log
AgentConfigtypes.goAgent behavior config: model, timeouts, policies, context budget
DecisionRecordtypes.goSingle step record: model, cost, tokens, latency, hashes
ApprovalRequesttypes.goHuman approval gate for sensitive tool executions
ApprovalResponsetypes.goResponse to approval request with optional state edits
QuestionRequesttypes.goAgent question directed at a human operator
SpeculativeConfigtypes.goConfig for speculative execution across multiple models
ToolRepairPolicytypes.goPolicy controlling automated tool error repair
TemporalConstraintstypes.goDeadline and fast-model config for time-bounded execution

Key Files

FilePurpose
workflow.goAgent workflow: decide → act → observe loop
activities.goTemporal activity implementations
types.goAll exported types and input/output structs
cost.goCost tracking and aggregation
context_budget.goContext window budget management
deadline.goDeadline pressure and fast-model switching
immune.goImmune system anomaly detection integration
metacognitive.goSelf-monitoring and escalation
speculative.goSpeculative multi-model execution