Rust

agent

Module

Agents: an adapter with a description, instructions and a schema.

Contents

use utopia_agents::Agent;
Rust
pub struct Agent<A>

An AI agent: a provider adapter, with a description, instructions and optionally a schema its answers must follow.

Rust
use utopia_agents::{Agent, OpenAi};

let mut agent = Agent::new(OpenAi::new("test-api-key"));
agent
    .set_description("You answer questions about the weather.")
    .add_instruction("Tone", "Be brief.");

assert_eq!(agent.description(), "You answer questions about the weather.");
assert_eq!(agent.instructions().len(), 1);
use utopia_agents::Profile;
Rust
pub struct Profile

What an agent tells its provider besides the conversation: a description, named instructions and, for structured output, a schema. Adapters read it in Adapter::send.

use utopia_agents::Instruction;
Rust
pub enum Instruction

The content of one instruction: one text, or lines joined by \n when sent.

Also implements From.