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
| Type | Source | Description |
|---|---|---|
AgentRunInput | types.go | Workflow input: config, state, tool registry ref, memory refs |
AgentRunResult | types.go | Workflow output: final state and decision log |
AgentConfig | types.go | Agent behavior config: model, timeouts, policies, context budget |
DecisionRecord | types.go | Single step record: model, cost, tokens, latency, hashes |
ApprovalRequest | types.go | Human approval gate for sensitive tool executions |
ApprovalResponse | types.go | Response to approval request with optional state edits |
QuestionRequest | types.go | Agent question directed at a human operator |
SpeculativeConfig | types.go | Config for speculative execution across multiple models |
ToolRepairPolicy | types.go | Policy controlling automated tool error repair |
TemporalConstraints | types.go | Deadline and fast-model config for time-bounded execution |
Key Files
| File | Purpose |
|---|---|
workflow.go | Agent workflow: decide → act → observe loop |
activities.go | Temporal activity implementations |
types.go | All exported types and input/output structs |
cost.go | Cost tracking and aggregation |
context_budget.go | Context window budget management |
deadline.go | Deadline pressure and fast-model switching |
immune.go | Immune system anomaly detection integration |
metacognitive.go | Self-monitoring and escalation |
speculative.go | Speculative multi-model execution |