Expand description
§temporal-agent-rs
Durable AI agent execution on top of Temporal using AutoAgents for the LLM-provider and tool abstractions.
§Pattern
The library re-implements the ReAct loop inside a Temporal workflow
(AgentWorkflow). The workflow stays deterministic; every LLM call and
every tool invocation is checkpointed as a separate Temporal activity. A
mid-loop crash resumes from the last completed activity without
re-spending LLM tokens.
§Quick start
use std::sync::Arc;
use temporal_agent_rs::prelude::*;
let runtime = temporalio_sdk_core::CoreRuntime::new_assume_tokio(Default::default())?;
let mut worker = AgentWorkerBuilder::new(client)
.llm(llm)
.tool(tool)
.queue("agents")
.build_worker(&runtime)?;
worker.run().await?;See the math_agent example for the full client-side flow.
Re-exports§
pub use crate::activities::AgentActivities;pub use crate::builder::AgentWorkerBuilder;pub use crate::error::AgentError;pub use crate::state::AgentInput;pub use crate::state::AgentOutput;pub use crate::state::AgentState;pub use crate::state::LlmChatInput;pub use crate::state::LlmResponse;pub use crate::state::Message;pub use crate::state::Role;pub use crate::state::StopReason;pub use crate::state::ToolCall;pub use crate::state::ToolResult;pub use crate::state::ToolSchema;pub use crate::tool::ToolRegistry;pub use crate::tool::ToolRegistryBuilder;pub use crate::workflow::AgentWorkflow;
Modules§
- activities
- Temporal activities backing the agent loop.
- builder
- Convenience builder for assembling an agent-aware Temporal worker.
- error
- Error types raised by activities and the agent loop.
- llm
- Conversions between local
Messages and AutoAgents’ChatMessage, plus the parser that turns an LLM response into anLlmResponse. - prelude
- Glob-importable prelude.
- state
- Serializable agent state stored in workflow history.
- tool
- Tool registry — bridges AutoAgents’
ToolTtrait into a name-based dispatch table used by theexecute_toolactivity. - workflow
AgentWorkflow— the durable agent loop.