Bas Cancrinus 526864b47e
feat(mcp): maintain agent credential grants at runtime (grants: runtime) (#8512)
* feat(mcp): maintain agent credential grants at runtime (grants: runtime)

An mcp_agent_auth binding can declare grants: runtime. config.yaml then keeps
only the server, agent and OAuth client; an administrator maintains the owners
and approved definition digests through /api/mcp/agent-auth, stored with the
agent_storage backend (table mcp_agent_grants, migration 0059, or one JSON file
per binding). A runtime binding without a grant admits nobody.

Run admission reads the grant for each matching binding, and every protected
call rechecks the owners, so a change applies without a Gateway restart:
removing an owner denies the next call, removing a digest stops new runs while
admitted runs keep their definition. An unreadable grant store denies admission
and calls. The API refuses writes to grants: config bindings and owners that
another enabled binding already covers for the same server and agent; admission
also fails closed if overlapping runtime grants race past that check.

grants: config (the default) behaves as before.

Closes #8503

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* fix(mcp): bind a runtime grant to the identity it was approved for

A runtime grant was keyed by binding ID only, so its owners and digests stayed
in force after config.yaml pointed the binding at another agent, server or
OAuth client, or the server at another destination. Each grant now records
that subject (agent, server, destination digest, nonsecret credential digest)
when an administrator writes it; admission and every protected call apply the
grant only while the subject still matches. Rotating the client secret keeps
it. The admin API reports approval: current/stale/none/config, and the overlap
check ignores grants that are no longer in force.

Also renumbers the migration to 0060 after upstream's 0059_coordination_grants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* fix(mcp): build grant stores off the event loop; reject owners file storage cannot hold

The admin routes built the grant store on the event loop; with SQLite the
factory resolves the database path on the filesystem. Construct the store in
the worker thread together with the read or drained write.

definition-digest with file-backed agent storage turned an owner such as
"alice@example.com" or "../alice" into a 500 from Paths.user_dir; it now
answers 422. Database-backed owners stay unrestricted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* test(mcp): put 0061_mcp_agent_grants after 0060_coordination_run_settings in the chain test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* fix(mcp): keep stale and retired runtime grants reserved, let admins delete them

- The owner overlap check counts every stored grant for the agent and server
  it was approved for, also while it is stale or its binding is gone, so a
  configuration rollback cannot reactivate a grant whose owners another
  binding took in the meantime.
- A grant whose binding was removed from config.yaml is listed and readable
  as approval: retired and can be deleted by its binding ID, which releases
  its owners. A grant left behind on a binding moved to grants: config can be
  deleted too.
- The file store treats a grant file removed by a concurrent delete as absent
  in get, list, put and delete; parse and other I/O errors still raise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* fix(mcp): chain grants after 0061_coordination_coordinator; keep owners of disabled bindings reserved

Rename the grants migration to 0062_mcp_agent_grants with down_revision
0061_coordination_coordinator so main keeps a single Alembic head, and
check the whole upgrade path in the chain test.

A disabled binding now keeps its owners reserved (stored grants and
grants: config owners), and a grant written to a disabled binding is
checked for overlaps too, so enabling it again cannot make admission
reject both bindings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

* fix(mcp): show a stored runtime grant on a binding moved to config grants

A grants: config binding whose earlier runtime grant is still stored hid that
grant in both GET routes, while the overlap check still counted its owners:
an administrator could get a 409 for an owner absent from the binding's
details. Both routes now return it as stored_grant (server, agent, owners,
digests) until it is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>

---------

Signed-off-by: Bas Cancrinus <7222814+bascan@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-25 23:23:47 +08:00
2026-02-13 11:49:51 +08:00

English | 中文 | 日本語 | Français | Русский | Português | 한국어

Python Node.js License: MIT

bytedance%2Fdeer-flow | Trendshift

On February 28th, 2026, DeerFlow claimed the 🏆 #1 spot on GitHub Trending following the launch of version 2. Thanks a million to our incredible community — you made this happen! 💪🔥

DeerFlow (Deep Exploration and Efficient Research Flow) is an open-source super agent harness that orchestrates sub-agents, memory, and sandboxes to do almost anything — powered by extensible skills.

https://github.com/user-attachments/assets/a8bcadc4-e040-4cf2-8fda-dd768b999c18

Note

DeerFlow 2.0 is a ground-up rewrite. It shares no code with v1. If you're looking for the original Deep Research framework, it's maintained on the 1.x branch — contributions there are still welcome. Active development has moved to 2.0.

Official Website

Learn more and see real demos on our official website. The landing-page case studies open as allowlisted, read-only showcases without requiring a sign-in.

Sister Projects

image
  • LLM Space - Meet our secret weapon behind DeerFlow — one desktop tool to prototype agent ideas, inspect each harness step, replay failures, and benchmark performance.

Coding Plan from ByteDance Volcengine

InfoQuest

DeerFlow has newly integrated the intelligent search and crawling toolset independently developed by BytePlus — InfoQuest (supports free online experience)

InfoQuest_banner

One-Line Agent Setup

If you use Claude Code, Codex, Cursor, Windsurf, or another coding agent, you can hand it the setup instructions in one sentence:

Help me clone DeerFlow if needed, then bootstrap it for local development by following https://raw.githubusercontent.com/bytedance/deer-flow/main/Install.md

That prompt is intended for coding agents. It tells the agent to clone the repo if needed, choose Docker when available, and stop with the exact next command plus any missing config the user still needs to provide.

Quick Start

git clone https://github.com/bytedance/deer-flow.git
cd deer-flow
make setup          # interactive wizard: writes config.yaml and .env (about 2 minutes)

Then start DeerFlow with Docker (recommended) or run it locally:

# Docker
make docker-init    # pull the sandbox image (once, or when the image updates)
make docker-start   # start services
# Local development
make check          # verifies Node.js 22+, pnpm, uv, nginx
make install
make dev

The local commands use the pnpm version pinned in frontend/package.json. If a different global pnpm is on PATH, they use Corepack when available; otherwise they report the version mismatch before installing frontend dependencies.

Run make doctor after setting model credentials. It reports obvious placeholder API keys as incomplete configuration; replace them with real keys before testing model calls.

Open http://localhost:2026.

From Deep Research to Super Agent Harness

DeerFlow started as a Deep Research framework — and the community ran with it. Since launch, developers have pushed it far beyond research: building data pipelines, generating slide decks, spinning up dashboards, automating content workflows. Things we never anticipated.

That told us something important: DeerFlow wasn't just a research tool. It was a harness — a runtime that gives agents the infrastructure to actually get work done.

So we rebuilt it from scratch.

DeerFlow 2.0 is no longer a framework you wire together. It's a super agent harness — batteries included, fully extensible. Built on LangGraph and LangChain, it ships with everything an agent needs out of the box: a filesystem, memory, skills, sandbox-aware execution, and the ability to plan and spawn sub-agents for complex, multi-step tasks.

Use it as-is. Or tear it apart and make it yours.

Guides

Each guide is the full reference for its topic. Open the one you need.

Topic Guide
Models, providers, config.yaml, environment variables Configuration
DeepSeek web search, thinking mode and citation excerpts DeepSeek Web Search
Docker, local development, upgrades, production deployment Running the Application
Workspace file tools, isolated shell providers, uploads and outputs Sandbox
boxd machines, bounded output copies and cleanup retries boxd sandbox provider
BytePlus veFaaS cloud sandboxes, SigV4 control plane and optional TOS mounts veFaaS sandbox provider
Skills, built-in tools, script workflows, Claude Code integration Skills & Tools
MCP servers and model-specific image handling MCP Server, Image results
Sub-agents, task delegation and optional SQLite checkpoint history Sub-Agents, Inspect one thread's child history, Tool restrictions
Agent teams, SQLite/PostgreSQL persistence and shutdown behavior Agent teams extension
Long-term memory Long-Term Memory
Session goals, context compaction, todo counters, task notes, evidence-based decisions Context, Goals and Agent Decisions
Private knowledge retrieval (RAGFlow) Private Knowledge Retrieval
Agentic browser control Agentic Browser Control
Projects, instructions, document shelf Projects
Scheduled tasks Scheduled Tasks
Feishu, Slack, Telegram, Discord, DingTalk and other IM channels IM Channels
GitHub webhooks and tool setup GitHub Event-Driven Agents
File attachments, downloads and Office previews File Previews
Token usage dashboard, workspace, chat archive Workspace UI
Terminal workbench Terminal Workbench (TUI)
Personal access tokens, stream actions, embedded Python client API Access and Python Client
Trace correlation, LangSmith, Langfuse, Monocle Tracing and Observability
Deployment risks, admin model, security recommendations Security Notice

DeerFlow is model-agnostic — it works with any LLM that implements the OpenAI-compatible API. That said, it performs best with models that support:

  • Long context windows (100k+ tokens) for deep research and multi-step tasks
  • Reasoning capabilities for adaptive planning and complex decomposition
  • Multimodal inputs for image understanding and video comprehension
  • Strong tool-use for reliable function calling and structured outputs

More Documentation

⚠️ Security Notice

DeerFlow can execute commands and read and write files. It is designed to run in a local trusted environment, and a Gateway admin account is equivalent to code execution on the host. Before you deploy it on a server or expose it to a network, read the full Security Notice and SECURITY.md.

Runtime tool approval is disabled by default. The Gateway warns at startup when it is disabled. See Skills & Tools for configuration.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for development setup, workflow, and guidelines.

License

This project is open source and available under the MIT License.

Acknowledgments

DeerFlow is built upon the incredible work of the open-source community. We are deeply grateful to all the projects and contributors whose efforts have made DeerFlow possible. Truly, we stand on the shoulders of giants.

We would like to extend our sincere appreciation to the following projects for their invaluable contributions:

  • LangChain: Their exceptional framework powers our LLM interactions and chains, enabling seamless integration and functionality.
  • LangGraph: Their innovative approach to multi-agent orchestration has been instrumental in enabling DeerFlow's sophisticated workflows.

These projects exemplify the transformative power of open-source collaboration, and we are proud to build upon their foundations.

Key Contributors

A heartfelt thank you goes out to the core authors of DeerFlow, whose vision, passion, and dedication have brought this project to life:

Your unwavering commitment and expertise have been the driving force behind DeerFlow's success. We are honored to have you at the helm of this journey.

Star History

Star History Chart

Description
An open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of tasks that could take minutes to hours.
Readme MIT 451 MiB
Languages
Python 81.8%
TypeScript 14.1%
MDX 2.8%
Shell 0.4%
HTML 0.4%
Other 0.4%