Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Agent

Defined in the agent module.
Rust AI Agent SDK The core Agent struct Agents are the primary execution unit in PraisonAI. They combine: - LLM provider for generating responses - Tools for performing actions - Memory for conversation history - Instructions for behavior

Fields

NameTypeDescription
idStringUnique agent ID
nameStringAgent name
instructionsStringSystem instructions
llmArc<dyn LlmProvider>LLM provider
toolsArc<RwLock<ToolRegistry>>Tool registry
memoryArc<RwLock<Memory>>Memory
configAgentConfigConfiguration

Methods

new

fn new() -> AgentBuilder
Create a new agent builder

simple

fn simple(instructions: impl Into<String>) -> Result<Self>
Create an agent with minimal config Parameters:
NameType
instructionsimpl Into&lt;String&gt;

id

fn id(&self) -> &str
Get the agent ID

name

fn name(&self) -> &str
Get the agent name

instructions

fn instructions(&self) -> &str
Get the instructions

model

fn model(&self) -> &str
Get the LLM model name

chat

async fn chat(&self, prompt: &str) -> Result<String>
Chat with the agent (main entry point) This is the primary method for interacting with an agent. It handles the full conversation loop including tool calls. Parameters:
NameType
prompt&str

start

async fn start(&self, prompt: &str) -> Result<String>
Start a conversation (alias for chat) Parameters:
NameType
prompt&str

run

async fn run(&self, task: &str) -> Result<String>
Run a task (alias for chat) Parameters:
NameType
task&str

add_tool

async fn add_tool(&self, tool: impl Tool + 'static) -> ()
Add a tool to the agent Parameters:
NameType
toolimpl Tool + 'static

tool_count

async fn tool_count(&self) -> usize
Get the number of tools

clear_memory

async fn clear_memory(&self) -> Result<()>
Clear conversation memory

history

async fn history(&self) -> Result<Vec<Message>>
Get conversation history

Source

View on GitHub

praisonai/src/agent/mod.rs at line 39

Rust Agent

Rust Overview

Rust Quickstart

Rust Installation

Rust Autonomy