Skip to main content

Module traits

Module traits 

Source
Expand description

Core trait abstractions for tool execution, agent running, search, and skills.

Why: DI through traits lets tcode swap concrete implementations (subprocess runner vs. in-process mock; Brave vs. Tavily search; fs skill store vs. embedded) without changing call sites. This is the SOA seam that keeps the workflow engine and PM loop testable. What: Defines ToolExecutor, AgentRunner, SearchProvider, and SkillResolver. All are object-safe (dyn-able) and Send + Sync.

ServiceTier and RunContext/HistoryMessage are byte-for-byte identical to the canonical definitions in trusty-agents-common (the same crate trusty-agents already re-exports these from — see crates/trusty-agents/src/tools/traits.rs) and are re-exported here rather than redeclared (#2893, epic #2892).

ToolExecutor/ToolResult and AgentRunner/AgentOutput stay LOCAL, deliberately NOT deduped against trusty-agents-common, because tcode’s versions carry fields the shared ones lack and that must not regress: ToolResult::Success.telemetry (Option<Box<ToolTelemetry>>, #2862) and AgentOutput.finish_status (Option<FinishStatus>, #2683; whose AgentOutput.usage: crate::perf::TokenUsage also carries a cost_usd field the shared TokenUsage lacks, #50). Unifying either would require either type-erasing tcode’s telemetry (ToolTelemetry depends on crate::events::{SearchHit, RecalledMemory}, which are not portable to the shared crate without a much larger events-module move) or extending trusty-agents-common’s TokenUsage/AgentOutput and updating every trusty-agents/cto-assistant call site that pattern-matches ToolResult::Success — a real design decision outside this behavior-preserving refactor’s scope. See PR discussion for #2893. Test: Mock impls of each trait are constructed in unit tests for ToolRegistry, delegating commands, and related code.

Structs§

AgentOutput
Structured output returned by an AgentRunner.
HistoryMessage
Simple {role, content} serializable form used over IPC.
RunContext
Per-invocation context threaded from orchestrator to agent runner.
SearchResult
A search hit returned by a SearchProvider.

Enums§

ServiceTier
RBAC service tier (trusty-agents #445).
ToolResult
Structured result of a tool execution.

Traits§

AgentRunner
Runs a task against a named agent.
SearchProvider
Web/code search backend abstraction.
SkillResolver
Resolves named skills to their Markdown content.
ToolExecutor
Object-safe executor interface for a single named tool.