add-fastapi-endpoint
Add a new endpoint to the agentic-platform FastAPI service in src/agentic_platform/api/main.py.
- License 许可
- MIT
- 最近更新
- 2026-09-21
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- add-fastapi-endpoint
- description
- Add a new endpoint to the agentic-platform FastAPI service in src/agentic_platform/api/main.py.
03 SKILL.md 正文
Add a new FastAPI endpoint
Steps
-
Define request/response models as pydantic
BaseModelsubclasses near the top ofapi/main.py, following the existingTaskRequest/TaskResponsepattern. UseField(min_length=..., max_length=...)or similar validation constraints — don't accept unvalidated free text where a bound makes sense. -
Use
Depends(get_pipeline)(or a new dependency function, following the same generator pattern withIterator[...]) to inject collaborators — never construct anAgenticPipelineor reach for global state directly inside a route handler. This is what makes routes testable viaapp.dependency_overrides. -
Translate domain exceptions to HTTP status codes explicitly — see how
HumanApprovalRequiredErrormaps to409 Conflict. Don't let internal exception types leak as unhandled 500s if there's a more meaningful status code. -
Add the route with an explicit
response_model=...so the OpenAPI schema and response validation stay accurate. -
Write an e2e test in
tests/e2e/test_api.pyusingTestClientandapp.dependency_overridesto inject a fake/deterministic collaborator — never hit a real LLM or external service in e2e tests. Always clearapp.dependency_overridesin afinallyblock so tests don't leak state into each other. -
Run
make ci.
04 同仓库更多 Skills
write-tests-100-coverage
Write tests that keep agentic-platform at 100% branch coverage without gaming the metric.
add-rag-source
Add a new document source into the HybridRetriever knowledge base in agentic-platform.
add-fastapi-endpoint
Add a new endpoint to the agentic-platform FastAPI service in src/agentic_platform/api/main.py.
add-agent-node
Add a new node (agent role) to the multi-agent SimpleGraph in agentic-platform, with routing and tests.
write-tests-100-coverage
Write tests that keep agentic-platform at 100% branch coverage without gaming the metric.
add-rag-source
Add a new document source into the HybridRetriever knowledge base in agentic-platform.