Documentation
¶
Overview ¶
Package agentflow provides a top-level convenience entry point for creating agents with minimal boilerplate.
Usage:
import "github.com/BaSui01/agentflow"
a, err := agentflow.New(agentflow.WithOpenAI("gpt-4o-mini"))
a, err := agentflow.New(agentflow.WithAnthropic("claude-sonnet-4-20250514"))
a, err := agentflow.New(agentflow.WithProvider(myProvider), agentflow.WithModel("custom"))
a, err := agentflow.New(agentflow.WithProvider(mainProvider), agentflow.WithToolProvider(toolProvider))
Index ¶
- func New(opts ...Option) (*agent.BaseAgent, error)
- type Option
- func WithAPIKey(key string) Option
- func WithAnthropic(model string) Option
- func WithDeepSeek(model string) Option
- func WithLogger(logger *zap.Logger) Option
- func WithModel(model string) Option
- func WithName(name string) Option
- func WithOpenAI(model string) Option
- func WithProvider(p llm.Provider) Option
- func WithSystemPrompt(prompt string) Option
- func WithToolProvider(p llm.Provider) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*options)
Option configures the agent created by New.
func WithAPIKey ¶
WithAPIKey overrides the API key for provider shortcuts.
func WithAnthropic ¶
WithAnthropic creates an Anthropic Claude provider. API key from ANTHROPIC_API_KEY env.
func WithDeepSeek ¶
WithDeepSeek creates a DeepSeek provider. API key from DEEPSEEK_API_KEY env.
func WithOpenAI ¶
WithOpenAI creates an OpenAI provider. API key from OPENAI_API_KEY env.
func WithProvider ¶
WithProvider sets a pre-built LLM provider.
func WithSystemPrompt ¶
WithSystemPrompt sets the system prompt.
func WithToolProvider ¶ added in v1.4.6
WithToolProvider sets a dedicated provider for tool-calling/ReAct loops. When omitted, tool-calling falls back to the main provider.
Directories
¶
| Path | Synopsis |
|---|---|
|
persistence/mongodb
Package mongodb provides adapter types that bridge the concrete MongoDB store implementations to the agent-layer interfaces defined in agent/interfaces.go.
|
Package mongodb provides adapter types that bridge the concrete MongoDB store implementations to the agent-layer interfaces defined in agent/interfaces.go. |
|
cmd
|
|
|
agentflow
command
|
|
|
config 包的 HTTP 配置管理 API。
|
config 包的 HTTP 配置管理 API。 |
|
examples
|
|
|
01_simple_chat
command
|
|
|
02_streaming
command
|
|
|
03_tool_use
command
|
|
|
04_custom_agent
command
|
|
|
05_workflow
command
|
|
|
06_advanced_features
command
|
|
|
07_mid_priority_features
command
|
|
|
08_low_priority_features
command
|
|
|
09_full_integration
command
|
|
|
11_multi_provider_apis
command
|
|
|
12_complete_rag_system
command
|
|
|
13_new_providers
command
|
|
|
14_guardrails
command
|
|
|
15_structured_output
command
|
|
|
16_a2a_protocol
command
|
|
|
17_high_priority_features
command
示例 17:高优先级功能演示 演示内容:产物管理、HITL 中断、OpenAPI 工具、部署、增强检查点与可视化构建
|
示例 17:高优先级功能演示 演示内容:产物管理、HITL 中断、OpenAPI 工具、部署、增强检查点与可视化构建 |
|
18_advanced_agent_features
command
|
|
|
19_2026_features
command
|
|
|
20_multimodal_providers
command
示例:使用多模态能力(向量、重排、语音合成、语音识别、图像)
|
示例:使用多模态能力(向量、重排、语音合成、语音识别、图像) |
|
21_research_workflow
command
|
|
|
internal
|
|
|
pkg
|
|
|
mongodb
Package mongodb provides MongoDB client management for agentflow.
|
Package mongodb provides MongoDB client management for agentflow. |
|
service
Package service defines a unified lifecycle interface for application services.
|
Package service defines a unified lifecycle interface for application services. |
|
tlsutil
Package tlsutil provides centralized TLS configuration for all HTTP clients, servers, and Redis connections in agentflow.
|
Package tlsutil provides centralized TLS configuration for all HTTP clients, servers, and Redis connections in agentflow. |
|
Package rag 提供 RAG(检索增强生成)能力。
|
Package rag 提供 RAG(检索增强生成)能力。 |
|
core
Package core 定义 RAG 层的最小检索契约、核心模型和错误映射。
|
Package core 定义 RAG 层的最小检索契约、核心模型和错误映射。 |
|
runtime
Package runtime 提供 RAG 运行时的唯一构建入口。
|
Package runtime 提供 RAG 运行时的唯一构建入口。 |