文件最后提交记录最后更新时间
docs(examples): improve skill scores across 8 skills (#1809) Hullo @mdrxy 👋 I ran your skills through tessl skill review at work and found some targeted improvements. The process was run by me, a human meatbag (yes, I am typing, and that's me (with shorter hair) in the avatar), with some assistance from a skill and claude, which feels fitting and somewhat meta, given it's measuring and updating some skills. So I would consider this a clear disclaimer that I have used AI, but I did human write this. This is done with good intent, not to land some slop, the goal is to improve the activation and use of the skills you're sharing here, that's all. 🙏 <!-- Replace everything above this line with a 1-2 sentence description of your change. Keep the "Fixes #xx" keyword and update the issue number. --> <img width="1312" height="1214" alt="deepagents_score_card" src="https://github.com/user-attachments/assets/2fbd8b01-b73a-40d9-96b4-2047eb5c4004" /> Here's the before/after: | Skill | Before | After | Change | |-------|--------|-------|--------| | query-writing | 53% | 100% | +47% | | arxiv-search | 52% | 94% | +42% | | blog-post | 59% | 89% | +30% | | social-media | 59% | 89% | +30% | | langgraph-docs | 56% | 86% | +30% | | web-research | 59% | 89% | +30% | | schema-exploration | 55% | 83% | +28% | | skill-creator (built-in) | 84% | 88% | +4% | <details> <summary>What changed</summary> **Description improvements (all skills)** - Added concrete action verbs to frontmatter descriptions (e.g. "Writes and structures long-form blog posts" instead of just "Use this skill when writing...") - Added explicit "Use when..." clauses with natural trigger terms users would actually say - Expanded trigger term coverage (e.g. "tweet", "thread", "caption" for social-media) **Body conciseness (7 skills)** - Removed redundant "When to Use This Skill" body sections — these are only read after triggering, so they waste context tokens - Removed filler intro sentences ("This skill provides a structured workflow for...") - Removed "Available Tools" and "Research Subagent Configuration" sections from web-research — the agent already knows its tools - Removed verbose "Common Exploration Patterns" and "Tips" sections from schema-exploration that restated earlier content - Trimmed "About Skills" and "What Skills Provide" sections from both skill-creator instances **arxiv-search (52% → 94%)** - Replaced 103 lines of verbose content with 34 focused lines - Removed explanations of what arXiv is, "When to Use" section, "Features" list, and "Notes" section - Kept only the essential: usage syntax, one example, and dependency install **langgraph-docs (56% → 86%)** - Added concrete capabilities to description (stateful agents, multi-agent workflows, human-in-the-loop) - Added error recovery guidance for failed fetch_url calls - Removed redundant "Overview" section **query-writing (53% → 100%)** - Added error recovery section for empty results, syntax errors, and timeouts </details> Honest disclosure — I work at @tesslio where we build tooling around skills like these. Not a pitch - just saw room for improvement and wanted to contribute. Want to self-improve your skills? Just point your agent (Claude Code, Codex, etc.) at [this Tessl guide](https://docs.tessl.io/evaluate/optimize-a-skill-using-best-practices) and ask it to optimize your skill. Ping me - [@popey](https://github.com/popey) - if you hit any snags. Thanks in advance 🙏 > **Disclaimer**: This contribution was assisted by generative AI tooling (Claude Code + tessl skill review). ## make format ``` make format 🎨 Formatting libs/acp [ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff format deepagents_acp/ tests/ Using CPython 3.12.11 Creating virtual environment at: .venv Built deepagents-acp @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/acp Installed 69 packages in 100ms 11 files left unchanged [ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff check --fix deepagents_acp/ tests/ All checks passed! 🎨 Formatting libs/cli [ "." = "" ] || uv run --all-groups ruff format . Using CPython 3.12.11 Creating virtual environment at: .venv Built deepagents-cli @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/cli Built deepagents @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/deepagents Installed 177 packages in 213ms 125 files left unchanged [ "." = "" ] || uv run --all-groups ruff check --fix . All checks passed! 🎨 Formatting libs/deepagents [ "." = "" ] || uv run --all-groups ruff format . Using CPython 3.12.11 Creating virtual environment at: .venv Installed 118 packages in 143ms 80 files left unchanged [ "." = "" ] || uv run --all-groups ruff check --fix . All checks passed! 🎨 Formatting libs/harbor [ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff format deepagents_harbor/ tests/ Using CPython 3.12.11 Creating virtual environment at: .venv Built deepagents-cli @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/cli Built deepagents-harbor @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/harbor Installed 198 packages in 390ms 7 files left unchanged [ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff check --fix deepagents_harbor/ tests/ All checks passed! 🎨 Formatting libs/partners/daytona [ "." = "" ] || uv run --all-groups ruff format . Using CPython 3.12.11 Creating virtual environment at: .venv Built langchain-daytona @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/daytona Installed 115 packages in 133ms 8 files left unchanged [ "." = "" ] || uv run --all-groups ruff check --fix . All checks passed! 🎨 Formatting libs/partners/modal [ "." = "" ] || uv run --all-groups ruff format . Using CPython 3.12.11 Creating virtual environment at: .venv Built langchain-modal @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/modal Installed 102 packages in 97ms 8 files left unchanged [ "." = "" ] || uv run --all-groups ruff check --fix . All checks passed! 🎨 Formatting libs/partners/runloop [ "." = "" ] || uv run --all-groups ruff format . Using CPython 3.12.11 Creating virtual environment at: .venv Built langchain-runloop @ file:///Users/alan/Projects/auto-p-o/langchain-ai/deepagents/libs/partners/runloop Installed 79 packages in 72ms 8 files left unchanged [ "." = "" ] || uv run --all-groups ruff check --fix . All checks passed! ✅ All packages formatted! ``` ## make lint ``` make lint 🔍 Linting libs/acp [ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff format deepagents_acp/ tests/ --diff 11 files already formatted [ "deepagents_acp/ tests/" = "" ] || uv run --group test ruff check deepagents_acp/ tests/ All checks passed! /Library/Developer/CommandLineTools/usr/bin/make type uv run --group test ty check deepagents_acp All checks passed! 🔍 Linting libs/cli [ "." = "" ] || uv run --all-groups ruff check . All checks passed! [ "." = "" ] || uv run --all-groups ruff format . --diff 125 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type PYTHON_FILES="." uv run --all-groups ty check . warning[possibly-missing-attribute]: Attribute kwargs may be missing on object of type _Call | None | @Todo --> tests/unit_tests/test_thread_selector.py:1409:22 | 1408 | mock_list_threads.assert_awaited_once() 1409 | kw = mock_list_threads.await_args.kwargs | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1410 | assert kw["limit"] == 20 1411 | assert kw["include_message_count"] is False | info: rule possibly-missing-attribute is enabled by default warning[possibly-missing-attribute]: Attribute kwargs may be missing on object of type _Call | None | @Todo --> tests/unit_tests/test_thread_selector.py:1501:22 | 1500 | mock_list_threads.assert_awaited_once() 1501 | kw = mock_list_threads.await_args.kwargs | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1502 | assert kw["limit"] == 20 1503 | assert kw["include_message_count"] is False | info: rule possibly-missing-attribute is enabled by default Found 2 diagnostics 🔍 Linting libs/deepagents [ "." = "" ] || uv run --all-groups ruff check . All checks passed! [ "." = "" ] || uv run --all-groups ruff format . --diff 80 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type uv run --all-groups ty check deepagents All checks passed! 🔍 Linting libs/harbor [ "deepagents_harbor/ tests/" = "" ] || uv run --group test ruff format deepagents_harbor/ tests/ --diff 7 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type PYTHON_FILES="deepagents_harbor/ tests/" [ "deepagents_harbor/ tests/" = "" ] || uv run --group test ty check deepagents_harbor/ tests/ All checks passed! 🔍 Linting libs/partners/daytona [ "." = "" ] || uv run --all-groups ruff check . All checks passed! [ "." = "" ] || uv run --all-groups ruff format . --diff 8 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type uv run --all-groups ty check langchain_daytona All checks passed! 🔍 Linting libs/partners/modal [ "." = "" ] || uv run --all-groups ruff check . All checks passed! [ "." = "" ] || uv run --all-groups ruff format . --diff 8 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type uv run --all-groups ty check langchain_modal All checks passed! 🔍 Linting libs/partners/runloop [ "." = "" ] || uv run --all-groups ruff check . All checks passed! [ "." = "" ] || uv run --all-groups ruff format . --diff 8 files already formatted /Library/Developer/CommandLineTools/usr/bin/make type uv run --all-groups ty check langchain_runloop All checks passed! ✅ All packages linted! ```2 个月前
Add text2sql example (#779) ## Add text-to-sql-agent example This example demonstrates building a natural language to SQL agent using DeepAgents and Claude Sonnet 4.5. **Features:** - Progressive disclosure pattern with AGENTS.md and on-demand skills - Two specialized skills: query-writing and schema-exploration - CLI interface with rich console output - Chinook SQLite database (digital media store sample data) - LangSmith tracing integration **Usage:** ```bash cd examples/text-to-sql-agent uv venv --python 3.11 && source .venv/bin/activate uv pip install -e . python agent.py "What are the top 5 best-selling artists?" Structure: Follows the same pattern as content-builder-agent with AGENTS.md, skills/, pyproject.toml, and uv.lock.4 个月前
nit: standardize naming (#849) use correct project name in a few places that were missed4 个月前
Add text2sql example (#779) ## Add text-to-sql-agent example This example demonstrates building a natural language to SQL agent using DeepAgents and Claude Sonnet 4.5. **Features:** - Progressive disclosure pattern with AGENTS.md and on-demand skills - Two specialized skills: query-writing and schema-exploration - CLI interface with rich console output - Chinook SQLite database (digital media store sample data) - LangSmith tracing integration **Usage:** ```bash cd examples/text-to-sql-agent uv venv --python 3.11 && source .venv/bin/activate uv pip install -e . python agent.py "What are the top 5 best-selling artists?" Structure: Follows the same pattern as content-builder-agent with AGENTS.md, skills/, pyproject.toml, and uv.lock.4 个月前
chore: correct brand name (#1025) 3 个月前
chore: correct brand name (#1025) 3 个月前
chore(examples): ban-relative-imports = "all" (#1959)2 个月前
Add text2sql example (#779) ## Add text-to-sql-agent example This example demonstrates building a natural language to SQL agent using DeepAgents and Claude Sonnet 4.5. **Features:** - Progressive disclosure pattern with AGENTS.md and on-demand skills - Two specialized skills: query-writing and schema-exploration - CLI interface with rich console output - Chinook SQLite database (digital media store sample data) - LangSmith tracing integration **Usage:** ```bash cd examples/text-to-sql-agent uv venv --python 3.11 && source .venv/bin/activate uv pip install -e . python agent.py "What are the top 5 best-selling artists?" Structure: Follows the same pattern as content-builder-agent with AGENTS.md, skills/, pyproject.toml, and uv.lock.4 个月前
chore(deps): bump aiohttp from 3.13.3 to 3.13.4 in /examples/text-to-sql-agent (#2403) [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=aiohttp&package-manager=uv&previous-version=3.13.3&new-version=3.13.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - @dependabot rebase will rebase this PR - @dependabot recreate will recreate this PR, overwriting any edits that have been made to it - @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency - @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/langchain-ai/deepagents/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2 个月前
README.md

Text-to-SQL Deep Agent

A natural language to SQL query agent powered by LangChain's Deep Agents framework. This is an advanced version of a text-to-SQL agent with planning, filesystem, and subagent capabilities.

What is Deep Agents?

Deep Agents is a sophisticated agent framework built on LangGraph that provides:

  • Planning capabilities - Break down complex tasks with write_todos tool
  • Filesystem backend - Save and retrieve context with file operations
  • Subagent spawning - Delegate specialized tasks to focused agents
  • Context management - Prevent context window overflow on complex tasks

Demo Database

Uses the Chinook database - a sample database representing a digital media store.

Quick Start

Prerequisites

Installation

  1. Clone the deepagents repository and navigate to this example:
git clone https://github.com/langchain-ai/deepagents.git
cd deepagents/examples/text-to-sql-agent
  1. Download the Chinook database:
# Download the SQLite database file
curl -L -o chinook.db https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite
  1. Create a virtual environment and install dependencies:
# Using uv (recommended)
uv venv --python 3.11
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .
  1. Set up your environment variables:
cp .env.example .env
# Edit .env and add your API keys

Required in .env:

ANTHROPIC_API_KEY=your_anthropic_api_key_here

Optional:

LANGCHAIN_TRACING_V2=true
LANGSMITH_ENDPOINT=https://api.smith.langchain.com
LANGCHAIN_API_KEY=your_langsmith_api_key_here
LANGCHAIN_PROJECT=text2sql-deepagent

Usage

Command Line Interface

Run the agent from the command line with a natural language question:

python agent.py "What are the top 5 best-selling artists?"
python agent.py "Which employee generated the most revenue by country?"
python agent.py "How many customers are from Canada?"

Programmatic Usage

You can also use the agent in your Python code:

from agent import create_sql_deep_agent

# Create the agent
agent = create_sql_deep_agent()

# Ask a question
result = agent.invoke({
    "messages": [{"role": "user", "content": "What are the top 5 best-selling artists?"}]
})

print(result["messages"][-1].content)

How the Deep Agent Works

Architecture

User Question
     ↓
Deep Agent (with planning)
     ├─ write_todos (plan the approach)
     ├─ SQL Tools
     │  ├─ list_tables
     │  ├─ get_schema
     │  ├─ query_checker
     │  └─ execute_query
     ├─ Filesystem Tools (optional)
     │  ├─ ls
     │  ├─ read_file
     │  ├─ write_file
     │  └─ edit_file
     └─ Subagent Spawning (optional)
     ↓
SQLite Database (Chinook)
     ↓
Formatted Answer

Configuration

Deep Agents uses progressive disclosure with memory files and skills:

AGENTS.md (always loaded) - Contains:

  • Agent identity and role
  • Core principles and safety rules
  • General guidelines
  • Communication style

skills/ (loaded on-demand) - Specialized workflows:

  • query-writing - How to write and execute SQL queries (simple and complex)
  • schema-exploration - How to discover database structure and relationships

The agent sees skill descriptions in its context but only loads the full SKILL.md instructions when it determines which skill is needed for the current task. This progressive disclosure pattern keeps context efficient while providing deep expertise when needed.

Example Queries

Simple Query

"How many customers are from Canada?"

The agent will directly query and return the count.

Complex Query with Planning

"Which employee generated the most revenue and from which countries?"

The agent will:

  1. Use write_todos to plan the approach
  2. Identify required tables (Employee, Invoice, Customer)
  3. Plan the JOIN structure
  4. Execute the query
  5. Format results with analysis

Deep Agent Output Example

The Deep Agent shows its reasoning process:

Question: Which employee generated the most revenue by country?

[Planning Step]
Using write_todos:
- [ ] List tables in database
- [ ] Examine Employee and Invoice schemas
- [ ] Plan multi-table JOIN query
- [ ] Execute and aggregate by employee and country
- [ ] Format results

[Execution Steps]
1. Listing tables...
2. Getting schema for: Employee, Invoice, InvoiceLine, Customer
3. Generating SQL query...
4. Executing query...
5. Formatting results...

[Final Answer]
Employee Jane Peacock (ID: 3) generated the most revenue...
Top countries: USA ($1000), Canada ($500)...

Project Structure

text-to-sql-agent/
├── agent.py                      # Core Deep Agent implementation with CLI
├── AGENTS.md                     # Agent identity and general instructions (always loaded)
├── skills/                       # Specialized workflows (loaded on-demand)
│   ├── query-writing/
│   │   └── SKILL.md             # SQL query writing workflow
│   └── schema-exploration/
│       └── SKILL.md             # Database structure discovery workflow
├── chinook.db                    # Sample SQLite database (downloaded, gitignored)
├── pyproject.toml                # Project configuration and dependencies
├── uv.lock                       # Locked dependency versions
├── .env.example                  # Environment variable template
├── .gitignore                    # Git ignore rules
├── text-to-sql-langsmith-trace.png  # LangSmith trace example image
└── README.md                     # This file

Requirements

All dependencies are specified in pyproject.toml:

  • deepagents >= 0.3.5
  • langchain >= 1.2.3
  • langchain-anthropic >= 1.3.1
  • langchain-community >= 0.3.0
  • langgraph >= 1.0.6
  • sqlalchemy >= 2.0.0
  • python-dotenv >= 1.0.0
  • tavily-python >= 0.5.0
  • rich >= 13.0.0

LangSmith Integration

Setup

  1. Sign up for a free account at LangSmith
  2. Create an API key from your account settings
  3. Add these variables to your .env file:
LANGCHAIN_TRACING_V2=true
LANGSMITH_ENDPOINT=https://api.smith.langchain.com
LANGCHAIN_API_KEY=your_langsmith_api_key_here
LANGCHAIN_PROJECT=text2sql-deepagent

What You'll See

When configured, every query is automatically traced:

Deep Agent LangSmith Trace Example

You can view:

  • Complete execution trace with all tool calls
  • Planning steps (write_todos)
  • Filesystem operations
  • Token usage and costs
  • Generated SQL queries
  • Error messages and retry attempts

View your traces at: https://smith.langchain.com/

Resources

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.