MCPcopy Index your code
hub / github.com/InfinitiBit/graphbit / AgentTrait

Interface AgentTrait

core/src/agents.rs:90–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88/// Trait that all agents must implement
89#[async_trait]
90pub trait AgentTrait: Send + Sync {
91 /// Get agent ID
92 fn id(&self) -> &AgentId;
93
94 /// Get agent configuration
95 fn config(&self) -> &AgentConfig;
96
97 /// Process a message and return a response
98 async fn process_message(
99 &self,
100 message: AgentMessage,
101 context: &mut WorkflowContext,
102 ) -> GraphBitResult<AgentMessage>;
103
104 /// Execute a message and return structured data (for optimized workflow execution)
105 async fn execute(&self, message: AgentMessage) -> GraphBitResult<serde_json::Value>;
106
107 /// Validate agent output against expected schema
108 async fn validate_output(&self, output: &str, schema: &serde_json::Value) -> ValidationResult;
109
110 /// Check if agent has a specific capability
111 fn has_capability(&self, capability: &AgentCapability) -> bool {
112 self.config().capabilities.contains(capability)
113 }
114
115 /// Get supported capabilities
116 fn capabilities(&self) -> &[AgentCapability] {
117 &self.config().capabilities
118 }
119
120 /// Get access to the LLM provider for direct tool calling
121 fn llm_provider(&self) -> &LlmProvider;
122}
123
124/// Standard LLM-based agent implementation
125pub struct Agent {

Callers

nothing calls this directly

Implementers 4

agents.rscore/src/agents.rs
system_prompt_tests.rstests/rust_unit_tests/system_prompt_te
agent_tests.rstests/rust_unit_tests/agent_tests.rs
workflow_tests.rstests/rust_unit_tests/workflow_tests.r

Calls

no outgoing calls

Tested by

no test coverage detected