systemprompt-agent 0.15.0

Agent-to-Agent (A2A) protocol for systemprompt.io AI governance: streaming, JSON-RPC models, task lifecycle, .well-known discovery, and governed agent orchestration.
Documentation
use crate::services::shared::{AgentServiceError, Result};
use std::sync::Arc;

use systemprompt_models::AiProvider;

use super::Server;
use crate::state::AgentState;

pub async fn run_standalone(
    agent_state: Arc<AgentState>,
    ai_service: Arc<dyn AiProvider>,
    agent_name: &str,
    port: u16,
) -> Result<()> {
    let server = Server::new(
        Arc::clone(agent_state.db_pool()),
        agent_state,
        ai_service,
        Some(agent_name.to_owned()),
        port,
    )
    .await
    .map_err(|e| AgentServiceError::Internal(format!("Failed to create agent server: {e}")))?;

    server
        .run()
        .await
        .map_err(|e| AgentServiceError::Internal(format!("Agent server failed: {e}")))?;

    Ok(())
}