- 补齐 tool_call 和 edge 验证链路的 duration_ms 计算与返回 - 任务详情和任务报告新增 result_summary_detail 结构化摘要 - 摘要中补充最终状态、失败原因、software-a 摘要、审批摘要、验证摘要 - 软件A层术语统一为“最小能力实现” - 同步更新 README、当前进度总结和相关设计文档 - 补充并通过对应自动化测试
Smart Deploy Agent Demo Backend
Setup
python -m venv .venv
.venv\\Scripts\\python -m pip install -e backend
Run
.venv\\Scripts\\python -m uvicorn app.main:app --reload --app-dir backend
Test
The lightweight API verification can run with in-memory SQLite:
set PYTHONPATH=backend
set DATABASE_URL=sqlite:///:memory:
.venv\\Scripts\\python -m pytest backend/tests -q -p no:cacheprovider
Runtime Notes
This repo currently defaults to:
- database:
sqlite:///./data/agent_demo.db - demo cache / queue: no Redis dependency
- edge defaults:
edge_id=edge-shanghai-001tool_name=http_health_check - demo operator defaults:
alice(u1001)for task executionbob(u2001)for approval
In the current sandbox, file-based SQLite may fail with disk I/O error.
For tests and local verification here, use:
set DATABASE_URL=sqlite:///:memory:
Implemented API Scope
Current backend includes:
- agent task
POST /api/agent/tasksPOST /api/agent/tasks/{task_id}/confirmPOST /api/agent/tasks/{task_id}/cancelGET /api/agent/tasks/{task_id}GET /api/agent/tasks/{task_id}/report - demo identity
POST /api/demo/identity/loginGET /api/demo/identity/meGET /api/demo/identity/users/{user_id}/permissionsPOST /api/demo/identity/token/introspect - demo approval
POST /api/demo/approval/requestsGET /api/demo/approval/requests/{approval_id}POST /api/demo/approval/requests/{approval_id}/decisionGET /api/demo/approval/requests - software-a minimal implementation
POST /api/demo/software-a/deploy-tasksGET /api/demo/software-a/deploy-tasks/{software_a_task_id}POST /api/demo/software-a/permissions/check - edge
POST /api/agent/edge/heartbeatPOST /api/agent/edge/tasks/pullPOST /api/agent/edge/tasks/reportPOST /api/agent/edge/events
Current execution flow:
- create task
- confirm task
- high-risk task enters approval flow
- check
software-aminimal implementation permission - create
software-aminimal implementation deploy task - create default edge verification step
- edge pulls and reports verification result
- task reaches
SUCCEEDED/FAILED/CANCELLED - task detail/report returns software-a status, approval trace, tool trace, verification trace and audit trace
Current execution metrics:
tool_call.duration_msis persisted fromstarted_at/finished_atverification_trace.duration_msis persisted for edge task reports
Current result summary capabilities:
- task detail/report returns
result_summary_detail - summary includes final status, final reason, software-a result, approval result and verification result
Demo failure semantics currently include:
- if
app_codeorversioncontainsfail, thesoftware-aminimal implementation returns a failed deploy task - approval rejection moves task to
CANCELLED - failed edge report moves task to
FAILED
Current Verification Baseline
Automated tests currently cover:
- create / confirm / get task
- high-risk approval path
- identity and software-a minimal implementation APIs
- edge heartbeat / pull / report
- edge event report
- task report trace aggregation
- cancel running task
Current baseline: 14 passed
Next Focus
Recommended next implementation steps:
- add more idempotency and rollback tests
- continue enriching audit details and task-level aggregate metrics
- continue toward local edge-agent bootstrap
- then continue with second-batch OpenAPI