بنقرة واحدة
add-endpoint
Add a new FastAPI endpoint to the API
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Add a new FastAPI endpoint to the API
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Read-only — assemble the wider runtime picture of a deployed voice app from azd deployment artifacts and Azure Monitor (Application Insights / Log Analytics) via Azure MCP or az CLI, then render it as KQL, call timelines, latency waterfalls, and mermaid diagrams
Service catalog and guided onboarding for the azd deployment. USE WHEN the user wants to discover, install, set up, or be walked through the deployable components (Azure OpenAI/AI Foundry, Speech, ACS/telephony, Cosmos DB, Redis, Container Apps, Key Vault, App Config, CardAPI MCP), asks "what gets deployed", "what services does this use", "help me onboard", "set up the deployment", "guide me through azd up", "which components do I need", or wants to enable optional pieces (phone number, EasyAuth, data seeding). Acts as the entry point an agent hooks into to assess current state, present the catalog, and onboard each component. DO NOT USE FOR: deep azd hook/flow internals or model-availability checks (use deployment-guide); runtime failure diagnosis (use troubleshoot); telemetry/log analysis (use observability-insights).
Agent-first, read-only diagnosis of the voice pipeline (deploy, telephony, STT, LLM, TTS, state) — gather evidence via Azure MCP / azd artifacts / CLI, probe the user for missing details, and recommend fixes without changing anything
Require relevant tests and documentation updates for any code or config change, and report what was run.
Create or update evaluation scenarios for the tests/evaluation framework, including session-based scenarios and A/B comparisons
Guide azd-based deployments, including where azure.yaml and azd hook scripts live, the current deployment flow, troubleshooting docs, and regional/model availability checks for Azure OpenAI
| name | add-endpoint |
| description | Add a new FastAPI endpoint to the API |
Add endpoints to apps/artagent/backend/api/v1/endpoints/.
"""
Endpoint Module
===============
Brief description of endpoints in this module.
"""
from __future__ import annotations
from fastapi import APIRouter, HTTPException, Request
from pydantic import BaseModel, Field
from utils.ml_logging import get_logger
logger = get_logger(__name__)
router = APIRouter()
# ═══════════════════════════════════════════════════════════════════════════════
# SCHEMAS
# ═══════════════════════════════════════════════════════════════════════════════
class MyRequest(BaseModel):
"""Request model for the endpoint."""
field1: str = Field(..., description="Required field")
field2: int | None = Field(None, description="Optional field")
class MyResponse(BaseModel):
"""Response model for the endpoint."""
success: bool
data: str
# ═══════════════════════════════════════════════════════════════════════════════
# ENDPOINTS
# ═══════════════════════════════════════════════════════════════════════════════
@router.get("/resource", response_model=MyResponse, tags=["Category"])
async def get_resource(request: Request) -> MyResponse:
"""
Get a resource.
Returns the resource data.
"""
return MyResponse(success=True, data="result")
@router.post("/resource", response_model=MyResponse, tags=["Category"])
async def create_resource(request: Request, body: MyRequest) -> MyResponse:
"""
Create a new resource.
Args:
body: The resource data to create.
"""
logger.info("Creating resource: %s", body.field1)
return MyResponse(success=True, data=body.field1)
api/v1/endpoints/ or edit existingtags=["Category"] for OpenAPI groupingapi/v1/__init__.pyIn apps/artagent/backend/api/v1/__init__.py:
from apps.artagent.backend.api.v1.endpoints import my_module
api_router.include_router(
my_module.router,
prefix="/my-resource",
tags=["MyResource"],
)
@router.get("/resource")
async def get_resource(request: Request):
redis = request.app.state.redis_client
# Use redis...
@router.get("/resource/{resource_id}")
async def get_resource(resource_id: str) -> MyResponse:
...
@router.get("/resources")
async def list_resources(
limit: int = 10,
offset: int = 0,
) -> list[MyResponse]:
...
@router.get("/resource/{id}")
async def get_resource(id: str) -> MyResponse:
resource = await fetch_resource(id)
if not resource:
raise HTTPException(status_code=404, detail="Resource not found")
return resource
Use consistent tags:
Health - Health/readiness endpointsCalls - Call managementAgents - Agent operationsVoice - Voice/speech operationsSessions - Session managementFor reusable schemas, add to api/v1/schemas/:
# api/v1/schemas/my_schemas.py
from pydantic import BaseModel
class SharedSchema(BaseModel):
field: str
For models with timestamps/IDs, extend base:
from apps.artagent.backend.api.v1.models.base import BaseModel
class MyModel(BaseModel):
field: str
# Automatically gets id, created_at, updated_at