Skip to main content

Module agent_source

Module agent_source 

Source
Expand description

LLM agent source adapter — wraps AIProvider as a pipeline node Agent source adapter — wraps an [AIProvider] as a pipeline data source.

Implements [AgentSourcePort] and [ScrapingService] so that an LLM can be used as a node in the DAG pipeline. Unlike the AI adapters (which extract structured data from existing content), this adapter generates content by executing a user-supplied prompt.

§Example

use stygian_graph::adapters::agent_source::AgentSource;
use stygian_graph::adapters::mock_ai::MockAIProvider;
use stygian_graph::ports::agent_source::{AgentSourcePort, AgentRequest};
use serde_json::json;
use std::sync::Arc;

let provider = Arc::new(MockAIProvider);
let agent = AgentSource::new(provider);
let resp = agent.invoke(AgentRequest {
    prompt: "Summarise the data".into(),
    context: Some("raw data here".into()),
    parameters: json!({}),
}).await.unwrap();
println!("{}", resp.content);

Structs§

AgentSource
Adapter: LLM agent as a pipeline data source.