Communitygithub.com

fly-peach/agent-pro-skills

Initializes a full-stack Agent Console project: DeepAgents backend (runtime config middleware + composite backend + skill library), official deep-agents-ui frontend (chat/config dual tabs, tool registration dual tabs, placeholder for undeveloped features), and Docker + Postgres persistence for deployment.

What is agent-pro-skills?

This skill generates a complete, production-ready scaffolding for an Agent Console project based on the DeepAgents framework. It is ideal for developers who need to quickly bootstrap an agent project with a robust backend and a polished frontend. The backend integrates runtime configuration middleware (RuntimeConfigMiddleware) that dynamically swaps models and tools per invocation, a composite backend for file and execution management, and a skill library supporting SKILL.md uploads. The frontend, structured like the official deep-agents-ui, includes a multi-tab interface for chat, configuration (system prompt, model settings), tool registration, and skill management, all styled with two theme variants. Deployment is fully containerized with Docker, using Postgres (pgvector) for persistence across sessions, threads, configurations, and skills, ensuring data survives container rebuilds. The project also handles critical pitfalls, such as unreliable hot reloading on Windows and WSL container shutdown, with built-in workarounds like `restart: unless-stopped` and a preflight check script (`agent-dev/env-preflight`).

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/fly-peach/agent-pro-skills/tree/HEAD/agent-dev/agent-init

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Agent Console Initialization (DeepAgents Full Stack · Complete Form)

Before starting, run agent-dev/env-preflight (install docker/python/uv/bun + environment health check + version consistency).

Detailed resources are in references/: Copyable code in references/templates/, block-by-block explanations in references/backend-agent.md / backend-api.md / langgraph-json.md / docker-deploy.md / frontend.md, all pitfalls in references/pitfalls.md. This file only covers form, decisions, and workflow.

1. Complete Form (This Is What "Initialize an Agent" Looks Like)

┌─ Frontend (Vite + React + @langchain/react)──────────────────────────────┐
│ Top bar: Brand name · Navigation [Chat / Config / Tool Registration / Undeveloped UI] · Theme toggle |
│                                                                      │
│ Chat page     Left: conversation list (search/copy/delete/clean empties/collapsible)              │
│              Center: message stream (tool cards / sub-agents / reasoning stream / Tasks-Files panel)  │
│              Composer: reasoning toggle · history (checkpoint time travel) · send            │
│              Right: run details panel (**Undeveloped placeholder**)                            │
│ Config page     tab1 Agent config: system prompt (custom instructions) + recursion limit       │
│            tab2 Model config: provider / key / standard & reasoning models / temperature   │
│ Tool registration   tab1 Tools: two-level expander (integrated / self-developed → official groups)      │
│            tab2 Skills: SKILL.md skill library (zip upload / paste creation / delete)    │
│ Undeveloped UI   Placeholder page (only shows "Not Developed")                                    │
└──────────────────────────────────────────────────────────────────────┘
                              ↕ HTTP/SSE
┌─ Backend (Python + deepagents + langgraph)─────────────────────────────┐
│ agent.py    Dual graph registration (agent / agent-thinking)                         │
│            RuntimeConfigMiddleware: dynamically swap models / filter tools per config            │
│                                    / append system prompt              │
│            CompositeBackend: default=LocalShellBackend (execute available)                            │
│                            routes: /skills/ real directory, /notes/ state            │
│            TOOL_REGISTRY (custom tools) + skills=["/skills/"]             │
│            TodoListMiddleware (planning, must be explicitly mounted)                      │
│ api.py     /demo/* management routes: model config / Agent config / tool registry / skill library│
│ Config       model_config.json, agent_config.json (mountable as volumes)              │
│ Data       skills/ (skill library), sandbox/ (execute working directory)             │
└──────────────────────────────────────────────────────────────────────┘
                              ↕
┌─ Deployment (Docker)──────────────────────────────────────────────────────┐
│ postgres(pgvector:pg16) + redis + langgraph-api + frontend(nginx)    │
│ Volumes: pgdata(sessions) / appdata(thread metadata) / cfgdata(config) / datadata(skills)│
│ OSS route: python:3.12-slim + langgraph-cli[inmem] + custom PG checkpointer│
└──────────────────────────────────────────────────────────────────────┘

2. Seven Key Decisions (Solidified After Hitting Pitfalls)

  1. Runtime Config Middleware: RuntimeConfigMiddleware reads config before each model invocation (model / tool enable/disable / system prompt append). Changing config = writing a file; it takes effect on the next run. Do not rely on hot reload or rebuild the graph (hot reload of langgraph dev is unreliable on Windows). → references/backend-agent.md
  2. Reasoning Mode = Multi-Graph Registration + Frontend Switching of AssistantId: agent (standard model) and agent-thinking (deepseek-reasoner) each have their own graph. The frontend "reasoning" toggle switches assistantId and uses key to remount. Thread states are shared across graphs, so the conversation list must not filter by graph; when switching, continue using the current threadId as the seed.
  3. Admin Backend Goes via http.app in langgraph.json (/demo/*), same process and port as the graph; langgraph-cli[inmem] does not include fastapi by default, it must be explicitly installed (file upload also requires python-multipart).
  4. Use Platform APIs Whenever Possible Instead of Building Custom Backend Endpoints: Sessions, runs, checkpoints, graph topology, store, and metrics are all provided by the platform (see /docs). Custom endpoints only cover "concepts the platform doesn't know": model keys, tool enable/disable, system prompt, skill library.
  5. Frontend Follows the Official deep-agents-ui Structure (conversation list / chat area / tool cards / Tasks-Files panel). Replace Next.js + shadcn with Vite + native CSS. Color scheme takes the two token sets from the official globals.css.
  6. Destructive operations always require confirmation (ConfirmDialog). Batch operations follow "pre-check → confirm → execute".
  7. Placeholder for undeveloped features: NotDeveloped component only shows "Not Developed"; the navigation item is directly called "Undeveloped UI"; do not write long planning lists.

3. Backend Key Points (See references/backend-agent.md and backend-api.md for Details)

# Composite backend: default determines execute availability; routes determine file storage
BACKEND = CompositeBackend(
    default=LocalShellBackend(root_dir=SANDBOX_DIR, virtual_mode=True),      # → execute available
    routes={
        "/skills/": FilesystemBackend(root_dir=SKILLS_DIR, virtual_mode=True),  # Skill library (real directory)
        "/notes/": StateBackend(),                                             # In-thread files (Tasks/Files panel)
    },
)
agent = create_deep_agent(
    model=build_model(key="model"),          # Placeholder instance; actual model injected by middleware
    tools=list(TOOL_REGISTRY.values()),
    system_prompt=SYSTEM_PROMPT,
    backend=BACKEND,
    skills=["/skills/"],                     # SKILL.md directory → inject skill list (progressive loading)
    middleware=[RuntimeConfigMiddleware("model"), TodoListMiddleware()],   # Planning must be explicitly mounted
)
agent_thinking = ...  # Same structure, model_key="thinking_model"
Built-in CapabilityProviderNotes
ls/read_file/write_file/edit_file/delete/glob/grepFilesystemMiddlewareGoes via backend routes
executeRequires SandboxBackendProtocolsupports_execution() only checks Composite's default
taskSubAgentMiddlewaredeepagents built-in general-purpose sub-agent
write_todosTodoListMiddleware (must be explicitly mounted)Data source for the frontend Tasks panel
Skill librarySkillsMiddleware (skills=[...])Cached once per thread (skills_metadata); can use pinned_skills for forced loading

Management API (api.py): /demo/model-config, /demo/agent-config (includes system_prompt + builtin_system_prompt), /demo/tools (all visible tools + grouping/source/availability), /demo/skills (list / zip upload / text creation / delete).

4. Frontend Key Points (See references/frontend.md for Details)

  • useStream({ apiUrl, assistantId, threadId, onThreadId }); optimistic updates are built-in; loading state uses isLoading; history hydration uses isThreadLoading
  • Switching assistantId / session uses key remount; submit includes config: { recursion_limit }
  • Reason stream must read from two sources: content blocks ({type:"reasoning"}) + additional_kwargs.reasoning_content
  • Multi-tab pages: tabs sync with URL (?tab=) + old route uses Navigate replace; each tab is an independent component
  • Theme toggles directly between two states + inline script in index.html to prevent flash
  • Conversation capabilities all go via platform APIs: threads.search/count/copy/prune/getHistory/updateState, assistants.search/getGraph

5. Deployment Key Points (See references/docker-deploy.md for Details)

  • Two routes: ① Official langchain/langgraph-api image (requires LANGSMITH_API_KEY/license); ② OSS server + custom checkpointer (default, no license required)
  • Data persistence: Sessions → PG (pgdata); Thread metadata → appdata; Configuration (including system prompt) → cfgdata; Skills/Sandbox → datadata
  • Configuration and data directories use environment variables pointing to volumes: AGENT_CONSOLE_CONFIG_DIR=/app/config, AGENT_CONSOLE_DATA_DIR=/app/data
  • Windows+WSL: WSL gets suspended after the last wsl.exe command finishes (.wslconfig's vmIdleTimeout is ineffective for WSL2) → Services use restart: unless-stopped + keep-alive sessions (already built into docker-up.ps1); native Linux servers should pay attention to firewall/security groups and systemctl enable docker
  • Before verifying persistence, first confirm the container is actually running (docker compose ps shows langgraph-api), otherwise you might be hitting a leftover dev service on the host

6. Initialization Workflow

0) agent-dev/env-preflight        → install-deps (install dependencies) + preflight (health check)
1) Backend: agent.py → api.py → langgraph.json → pyproject.toml → .env
   (Copy from references/templates/ and modify as per comments)
2) Start backend: langgraph dev --port 2024; verify with curl /ok, /demo/tools
3) Frontend: vite + @langchain/react + react-router; lib/chat.tsx → lib/api.ts → theme → components → pages
4) Integration test: Send a message (tool call + reply); switch to reasoning mode and verify reasoning stream
5) Docker: docker-compose.yml + Dockerfile.oss + checkpointer.py + start/stop scripts → verify "sessions/config/skills persist after container rebuild"
6) Documentation: Write the form and new pitfalls of this project back to the skill's references/

7. Pitfalls (Full Table in references/pitfalls.md)

Top Ten:

SymptomOne-Sentence Cause
Changed code, behavior unchangedHot reload of langgraph dev unreliable on Windows → Restart service and confirm the process is actually replaced
execute unavailablesupports_execution() only checks Composite's default → Set default to LocalShellBackend
Tasks/Files panel emptyAfter switching to a real backend, there is no files channel → Add a StateBackend route (/notes/) in Composite
model reports 'coroutine' object has no attribute 'result'awrap_model_call missing await handler(...)
See only 401 without configured keybefore_agent + @hook_config(can_jump_to=["end"]) short-circuit with a human-readable message
Upload endpoint reports Blocking call to os.getcwdEndpoint defined as async def → Change to sync def
Build reports not satisfiablerequires-python mismatches the image's Python version → Set python_version
Container exits with Exited (0) after ~10 secondsWSL gets suspended → restart: unless-stopped + keep-alive
Model "forgets", checkpoint is 0thread_id in body is ignored → Use POST /threads/{id}/runs/wait
Reasoning panel / file popup abnormalReasoning must read from two sources; files is a {content,…} structure

8. Variants and Roadmap

v1 intentionally omits: Orchestration page / topology visualization (normal agents using ReAct/DeepAgent default loop suffice; when needed, use getGraph(xray) + threads.getHistory + forkFrom + subagents=); human-in-the-loop interrupt (interrupt_on + stream.respond, Provider already reserved); long-term memory (/store/* + memory middleware); multiple environment dev/prod layering.

Other directions: Official frontend source (E:/deep-agents-ui, old SDK style); Deploy to LangGraph Platform (official image requires license, but threads/runs/assistants also persist to PG); Replace execute with a truly isolated sandbox (E2B / Daytona).

Related Skills