Skip to content

feat: ask_user (Q&A) + Monty run_python + SkillsToolset support#88

Merged
DEENUU1 merged 6 commits into
mainfrom
feat/qa-and-monty
Jun 12, 2026
Merged

feat: ask_user (Q&A) + Monty run_python + SkillsToolset support#88
DEENUU1 merged 6 commits into
mainfrom
feat/qa-and-monty

Conversation

@OchnikBartek

@OchnikBartek OchnikBartek commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Adds three PydanticAI-only agent capabilities to the generated template, stacked on #83:

  • ask_user — the agent pauses a run to ask the user one or more questions, then resumes with their answers (interactive multi-step card).
  • run_python — a Monty-sandboxed code-execution tool: compute, transform data, and emit live charts/maps in a single turn.
  • SkillsToolset — loads SKILL.md files from backend/skills/ as agent tools (loader only; drop in your own skills).

Changes

ask_user (Q&A)

  • ask_user tool: agent pauses, WebSocket session pauses/resumes, frontend QuestionPrompt multi-step card collects answers
  • Drop a stray ask_user_response frame (duplicate / post-reconnect) instead of surfacing a spurious "Empty message" error

Code execution (Monty)

  • enable_code_execution flag gating a run_python tool backed by pydantic-monty
  • In-sandbox create_chart / create_map / current_datetime emit live, persisted cards via emit_tool_event
  • AgentSession streams in-sandbox tool calls as the same tool_call/tool_result event pair as direct calls

Skills (SkillsToolset)

  • enable_skills flag + CLI --skills + interactive prompt
  • assistant.py: SkillsToolset registration (PydanticAI, gated on backend/skills/ existing — no-ops when empty)
  • pyproject: pydantic-ai-skills dep
  • Frontend: load_skill / list_skills tool-call rendering

CI / tests

  • New matrix configs pydantic_ai_code_execution and pydantic_ai_skills so both paths are linted + type-checked (previously uncovered)
  • Run ruff via uvx in the generated-project tests (matches the post-gen hook; avoids a stray VIRTUAL_ENV breaking local runs)

Testing

  • Matrix tests: generated pydantic_ai with --code-execution and with --skills (+ charts/AntV); compile, pass ruff + ty
  • test_template_integration.py green (CrewAI ty skipped — known py3.14 limitation)
  • Unit tests: test_config.py / test_cli.py / test_prompts.py — 227 passed
  • Linting passes: make lint (generator + generated backend)
  • Frontend build verified locally
  • Generated projects still work: PydanticAI + code-execution + skills + AntV

OchnikBartek and others added 4 commits June 1, 2026 15:44
…fety

- antv_chart.py: guard tool discovery with a module-level lock (CrewAI +
  LangChain loaders) so requests racing in the FastAPI threadpool can't
  each start an adapter; memoize only on success so a transient sidecar
  failure (e.g. still warming up) is retried instead of caching [] and
  pinning AntV off until the process restarts.
- docker-compose.yml (prod): drop the host port mapping for the
  antvis-chart sidecar — the backend reaches it over the internal
  network; publishing 1122 exposed an unauthenticated MCP/render endpoint.
- docker-compose.dev.yml: keep the host port, documented as dev-only.
- VARIABLES.md: correct the claim that the sidecar isn't in the prod
  compose — it is, just profile-gated and off by default.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
aiohttp 3.13.5 has CVE-2026-34993 and CVE-2026-47265 (fixed in 3.14.0).
pyjwt 2.12.1 has PYSEC-2026-175/177/178/179 (fixed in 2.13.0).
Both are transitive deps pulled in via the project venv; bumping them
unblocks the Security Scan CI job and re-enables all template test jobs
that were skipping because they need: [security].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@OchnikBartek OchnikBartek requested a review from DEENUU1 June 9, 2026 13:45
@OchnikBartek OchnikBartek self-assigned this Jun 9, 2026
@OchnikBartek OchnikBartek added the enhancement New feature or request label Jun 9, 2026
@OchnikBartek OchnikBartek changed the title feat: add ask_user (Q&A) tool + Monty run_python code execution feat: ask_user (Q&A) + Monty run_python + SkillsToolset support Jun 9, 2026
Base automatically changed from feat/advanced-charts to main June 12, 2026 17:07
# Conflicts:
#	fastapi_gen/cli.py
#	fastapi_gen/config.py
#	fastapi_gen/prompts.py
#	template/VARIABLES.md
#	template/cookiecutter.json
#	template/hooks/post_gen_project.py
#	template/{{cookiecutter.project_slug}}/backend/.env.example
#	template/{{cookiecutter.project_slug}}/backend/app/agents/assistant.py
#	template/{{cookiecutter.project_slug}}/backend/app/agents/prompts.py
#	template/{{cookiecutter.project_slug}}/backend/app/core/config.py
#	template/{{cookiecutter.project_slug}}/backend/pyproject.toml
#	template/{{cookiecutter.project_slug}}/frontend/src/components/chat/tool-call-card.tsx
#	tests/test_template_integration.py
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@DEENUU1 DEENUU1 merged commit 638a5e5 into main Jun 12, 2026
15 checks passed
@DEENUU1 DEENUU1 deleted the feat/qa-and-monty branch June 12, 2026 17:36
DEENUU1 added a commit that referenced this pull request Jun 12, 2026
…Monty), skills

Documents #83 (AntV advanced-diagram sidecar + Leaflet maps) and #88
(ask_user Q&A tool, Monty-sandboxed run_python code execution, SkillsToolset)
in the changelog and bumps the generator version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants