Skip to main content

Module agent

Module agent 

Source
Expand description

§Agent API Module

Provides support for Zhipu AI’s Agent API, enabling advanced AI agent interactions including creation, multi-turn conversations, tool use, and persistent state management.

§Core Types

§Usage

use zai_rs::agent::{AgentClient, AgentCreateRequest};

let client = AgentClient::new(api_key);

// Create an agent
let agent = client.create_agent(request).await?;

// Chat with the agent
let response = client.chat(&agent.id, chat_request).await?;

// Retrieve conversation history
let history = client.get_history(&agent.id, Some(10)).await?;

Re-exports§

pub use request::*;
pub use response::*;

Modules§

request
Agent API request types
response
Agent API response types

Structs§

AgentClient
Agent client for managing AI agent interactions

Constants§

AGENT_API_URL
Agent API endpoint for creating and managing AI agents