periplon 0.2.0

Rust SDK for building multi-agent AI workflows and automation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::domain::{AgentSession, Message, SessionId};
use crate::error::Result;
use crate::options::AgentOptions;
use async_trait::async_trait;
use futures::Stream;
use std::pin::Pin;

pub type MessageStream = Pin<Box<dyn Stream<Item = Result<Message>> + Send>>;

#[async_trait]
pub trait AgentService: Send + Sync {
    async fn query(&self, prompt: String, options: AgentOptions) -> Result<MessageStream>;
    async fn send_message(&self, session: SessionId, message: Message) -> Result<()>;
    async fn interrupt(&self, session: SessionId) -> Result<()>;
    async fn get_session(&self, session: SessionId) -> Result<AgentSession>;
}