Skip to main content

AgentSourcePort

Trait AgentSourcePort 

Source
pub trait AgentSourcePort: Send + Sync {
    // Required methods
    fn invoke<'life0, 'async_trait>(
        &'life0 self,
        request: AgentRequest,
    ) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn source_name(&self) -> &str;
}
Expand description

Port trait for LLM agent data sources.

Implementations wrap an LLM provider and expose it as a pipeline-compatible data source.

§Example

use stygian_graph::ports::agent_source::{AgentSourcePort, AgentRequest};
use serde_json::json;

let req = AgentRequest {
    prompt: "List the key takeaways".into(),
    context: Some("...article text...".into()),
    parameters: json!({}),
};
let resp = agent.invoke(req).await.unwrap();
println!("{}", resp.content);

Required Methods§

Source

fn invoke<'life0, 'async_trait>( &'life0 self, request: AgentRequest, ) -> Pin<Box<dyn Future<Output = Result<AgentResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the agent with the given request.

§Arguments
  • request - Prompt, optional context, and parameters.
§Returns
  • Ok(AgentResponse) - Generated content and metadata.
  • Err(StygianError) - Provider error, rate limit, etc.
Source

fn source_name(&self) -> &str

Name of this agent source for logging and identification.

Implementors§