智能AI工作流 是 AI Skill Hub 本期精选Agent工作流之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
智能AI工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
智能AI工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 方式一:pip 安装(推荐)
pip install sagent
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install sagent
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/rekursiv-ai/sagent
cd sagent
pip install -e .
# 验证安装
python -c "import sagent; print('安装成功')"
# 命令行使用
sagent --help
# 基本用法
sagent input_file -o output_file
# Python 代码中调用
import sagent
# 示例
result = sagent.process("input")
print(result)
# sagent 配置文件示例(config.yml) app: name: "sagent" debug: false log_level: "INFO" # 运行时指定配置文件 sagent --config config.yml # 或通过环境变量配置 export SAGENT_API_KEY="your-key" export SAGENT_OUTPUT_DIR="./output"
<p align="center"> <img alt="sagent logo" src="https://raw.githubusercontent.com/rekursiv-ai/sagent/main/assets/logo-custom.webp" width="180"> </p>
<p align="center"> The self-mutating multi-provider coding-agent CLI and typed Python library. </p>
<p align="center"> <img alt="Python" src="https://img.shields.io/badge/python-3.12-blue.svg"> <a href="https://pypi.org/project/sagent/"><img alt="PyPI" src="https://img.shields.io/pypi/v/sagent.svg"></a> <a href="https://github.com/rekursiv-ai/sagent/actions"><img alt="CI" src="https://img.shields.io/badge/ci-GitHub%20Actions-blue.svg"></a> <a href="https://github.com/rekursiv-ai/sagent/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue.svg"></a> </p>
<p align="center"> <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/tutorial.md">Tutorial</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/concepts.md">Concepts</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/providers.md">Providers</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/tools.md">Tools</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/cli.md">CLI</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/sessions.md">Sessions</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/security.md">Security</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/architecture.md">Architecture</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/api.md">API</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/streaming.md">Streaming</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/compaction.md">Compaction</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/slack.md">Slack</a> · <a href="https://github.com/rekursiv-ai/sagent/blob/main/docs/selfhosted.md">Self-hosted</a> · <a href="https://github.com/rekursiv-ai/sagent/tree/main/examples">Examples</a> </p>
Sagent requires Python 3.12 or newer. ripgrep and fd-find are optional — sagent has Python fallbacks when absent — but recommended for faster Grep / Glob. PDF rendering uses the bundled pypdfium2 wheel and needs no system install.
Sagent ships API-key providers for Anthropic, OpenAI, OpenAISubscription, Google, Moonshot, DashScope, MiniMax, and generic OpenAI-compatible endpoints, plus a managed local LlamaCpp provider. Set the key for the provider you plan to use:
export ANTHROPIC_API_KEY=...
export OPENAI_API_KEY=...
export GOOGLE_API_KEY=...
export MOONSHOT_API_KEY=...
export DASHSCOPE_API_KEY=...
export MINIMAX_API_KEY=...
| Provider | Environment variable | Example model |
|---|---|---|
Anthropic | ANTHROPIC_API_KEY | claude-sonnet-4-6 |
OpenAI | OPENAI_API_KEY | gpt-5.5 |
Google | GOOGLE_API_KEY | gemini-3.1-pro-preview |
Moonshot | MOONSHOT_API_KEY | kimi-k2.6 |
DashScope | DASHSCOPE_API_KEY | qwen3.6-plus |
MiniMax | MINIMAX_API_KEY | MiniMax-M2.7 |
SelfHosted | none | Qwen/Qwen3.6-27B |
LlamaCpp | none (uses LLAMA_CPP_MODEL + LLAMA_CPP_SERVER) | qwen3.6-27b-12gb |
See Providers for the provider matrix, inference rules, and OpenAI-compatible provider setup.
Use Claude backend,
sagent/bin/cli.py --allow-providers AnthropicCLI --provider AnthropicCLI --auth credentials
export GOOGLE_API_KEY=...
sagent/bin/cli.py --provider Google --model gemini-3.1-pro-preview
For non-interactive use, pipe a prompt on stdin:
printf 'Say hi in one sentence.' | \
sagent/bin/cli.py --provider Google --model gemini-3.1-pro-preview \
--output-format json
Use --continue to resume the most recent session for this working directory, --session PATH for an explicit session directory, or --ephemeral when prompts and auto-memory should not be written to disk. Use --max-budget-usd N to cap API spend for the current run.
import asyncio
from sagent import tools
from sagent.agent import Agent
from sagent.lib.json import json_freeze
from sagent.providers import Anthropic
async def main() -> None:
agent = Agent(
model=Anthropic.from_env().model("claude-sonnet-4-6"),
system="You are a concise coding assistant.",
tools=[tools.Read(), tools.Grep(), tools.Glob()],
)
result = await agent.run(json_freeze({"prompt": "Summarize README.md"}))
print(result.content)
asyncio.run(main())
Agent.run() accepts a JSON directive with a prompt key and returns a Message.
The examples/ directory contains small, runnable examples:
offline_custom_tool.py: run an agent/tool/model loop without API keys.decorator_tool.py: wrap a function as a tool.custom_tool.py: implement the full Tool protocol.multi_agent_reviewer.py: spawn an isolated reviewer child.openai_compatible_provider.py: connect an OpenAI-compatible endpoint.Start with the tutorial, then use the examples as copyable patterns. See Examples and Tools.
- One runtime, every surface. The same Agent class powers the CLI, your application code, and recursive sub-agents. - Typed Python objects. Agent, Tool, Model, Provider, and Message are protocols and dataclasses you import, compose, and unit-test. - Peer-to-peer agent messaging. Any spawned agent can AgentSend to any other named peer — not just its parent. Like user input, peer messages preempt the receiving agent's tool calls, so no agent blocks waiting on a stuck child.
Use it as a library:
from sagent import tools
from sagent.agent import Agent
from sagent.lib.json import json_freeze
from sagent.providers import Google
agent = Agent(
model=Google.from_env().model("gemini-3.1-pro-preview"),
system="You are a scientist.",
tools=[tools.Read(), tools.Glob(), tools.Grep()],
)
result = await agent.run(json_freeze({"prompt": "analyze the CSV in ./data/"}))
print(result.content)
<details> <summary>How Sagent compares to aider, LangChain, Claude Code, Codex CLI, Gemini CLI, and other adjacent projects</summary>
Not yet in Sagent: MCP, LSP, native sandboxing, desktop UI, tree-sitter repo map, hosted service, browser automation.
This comparison focuses on the runtime shape rather than every feature of each project.
| [Sagent](https://github.com/rekursiv-ai/sagent) | [aider](https://github.com/Aider-AI/aider) | [LangChain](https://github.com/langchain-ai/langchain) | [OpenClaw](https://github.com/openclaw/openclaw) | [Cline](https://github.com/cline/cline) | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | [Codex CLI](https://github.com/openai/codex) | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | [Flue](https://github.com/withastro/flue) | [Pi](https://pi.dev/) | [Attractor](https://github.com/strongdm/attractor) | [npcsh](https://github.com/npc-worldwide/npcsh) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Python library | ✅ | 🟡 | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
| Multi-provider | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
| Context compaction | ✅ | 🟡 | 🟡 | ❌ | 🟡 | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ |
| User-initiated backend swap | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ |
| Agent-initiated backend swap | ✅ | ❌ | 🟡 | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | 🟡 | ❌ |
| Agent self-mutation | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | 🟡 | ❌ | 🟡 |
| Context hot-swap | ✅ | 🟡 | 🟡 | 🟡 | 🟡 | ❌ | ❌ | ❌ | 🟡 | ✅ | ✅ | ❌ |
| Recursive agent spawn | ✅ | ❌ | ✅ | 🟡 | ❌ | 🟡 | 🟡 | ❌ | ✅ | 🟡 | ✅ | ✅ |
| Multi-agent (fully detached) | ✅ | ❌ | ✅ | ✅ | ❌ | 🟡 | 🟡 | ❌ | ✅ | 🟡 | ✅ | 🟡 |
| GitHub stars (May 2026) | -- | 44.4k | 135.8k | 368.6k | 61.4k | -- | 80.1k | 103.2k | 2.5k | 48.6k | 1.1k | 388 |
✅ = yes, 🟡 = partial, ❌ = no. Corrections welcome -- open a PR.
高质量的AI工作流项目,支持多提供商和异步调用
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,智能AI工作流 在Agent工作流赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | sagent |
| Topics | aiagentworkflowpython |
| GitHub | https://github.com/rekursiv-ai/sagent |
| License | Apache-2.0 |
| 语言 | Python |
收录时间:2026-06-04 · 更新时间:2026-06-04 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端