Skip to main content

phi_agent/
lib.rs

1//! phi-agent: General-purpose AI Agent framework
2//!
3//! Built on agent-base and agent-works, providing builder factory, renderer,
4//! config resolution, session management, and other infrastructure.
5//! **Does not bundle any tools** — tools are injected by consumers.
6
7pub mod agent;
8pub mod cli;
9pub mod config;
10pub mod event_log;
11pub mod prompt;
12pub mod render;
13pub mod session;
14
15// ── Common agent-base types ──
16// Only re-export the types consumers use most often.
17// For the full type set, import directly from agent-base.
18pub use agent_base::{
19    AgentBuilder, AgentError, AgentResult, AgentRuntime, ApprovalHandler, ConsecutiveFailureRecovery,
20    LlmClient, OpenAiClient, ReasoningConfig, ReasoningEffort, RunOutcome, RuntimeEvent, SafetyConfig,
21    SessionId, Tool, ToolContext, ToolControlFlow, ToolOutput, TurnFactMiddleware,
22    TurnToolLimitMiddleware, UpdatePlanTool, PlanItem, PlanStepStatus,
23};
24
25// ── agent-works ──
26pub use agent_works::focus::{Context as FocusContext, Focus, FocusError, FocusInput, FocusOutput};
27
28// ── phi-agent types ──
29pub use agent::{base_agent_builder, PhiAgent, PhiAgentConfig};
30pub use cli::{ApprovalMode, AutoApprovalHandler};
31pub use config::{resolve_llm_config, LlmConfig};
32pub use event_log::{event_to_jsonl, event_to_value, save_turn_log};
33pub use prompt::build_system_prompt;
34pub use render::{create_renderer, create_stdout_renderer, EventRenderer, JsonStreamRenderer, NullRenderer, OutputFormat};
35pub use session::SessionContext;