diff --git a/README.md b/README.md index 444b83e..bc2ab5a 100644 --- a/README.md +++ b/README.md @@ -281,20 +281,25 @@ curl -X PATCH "$AGENTBRIDGE_BASE_URL/api/agent/tasks/$TASK_ID" \ -d '{"status":"done","blockingReason":null,"note":"Implemented the dashboard card summary UI and verified lint/typecheck."}' ``` -Create a task for an agent in the same company: +Create a task for an agent in the same company. `assignedAgentId` is the assignee agent database UUID, not the API-facing `AgentId` header value. Resolve it from `GET /api/agent` for the acting agent, or from the dashboard/agents API for another assignee. ```bash +AGENT_UUID=$(curl -s "$AGENTBRIDGE_BASE_URL/api/agent" \ + -H "Authorization: Bearer $AGENTBRIDGE_COMPANY_TOKEN" \ + -H "AgentId: $AGENTBRIDGE_AGENT_ID" \ + -H "Accept: application/json" | jq -r '.agent.id') + curl -X POST "$AGENTBRIDGE_BASE_URL/api/agent/tasks" \ -H "Authorization: Bearer $AGENTBRIDGE_COMPANY_TOKEN" \ -H "AgentId: $AGENTBRIDGE_AGENT_ID" \ -H "Content-Type: application/json" \ - -d '{ - "projectId":"00000000-0000-0000-0000-000000000000", - "assignedAgentId":"11111111-1111-1111-1111-111111111111", - "name":"Document onboarding flow", - "job":"Update README with setup and API usage instructions.", - "status":"todo" - }' + -d "{ + \"projectId\":\"00000000-0000-0000-0000-000000000000\", + \"assignedAgentId\":\"$AGENT_UUID\", + \"name\":\"Document onboarding flow\", + \"job\":\"Update README with setup and API usage instructions.\", + \"status\":\"todo\" + }" ``` Useful Agent API resources: diff --git a/docs/production-runbook.md b/docs/production-runbook.md index 9fcd1eb..49538b4 100644 --- a/docs/production-runbook.md +++ b/docs/production-runbook.md @@ -193,7 +193,7 @@ Expected response: ### 4. Scripted SaaS smoke -For repeatable local, disposable, or production-like validation, run the scripted smoke against an AgentBridge instance that is safe to mutate. The script creates a disposable task in the configured project, lists tasks, marks that task `done`, writes a note summary, and marks it read by the smoke agent. +For repeatable local, disposable, or production-like validation, run the scripted smoke against an AgentBridge instance that is safe to mutate. The script resolves the authenticated agent profile from `/api/agent`, uses that profile `id` as the task `assignedAgentId` UUID, creates a disposable task in the configured project, lists tasks, marks that task `done`, writes a note summary, and marks it read by the smoke agent. Required environment: @@ -201,7 +201,7 @@ Required environment: | --------------------------- | ------------------------------------------------------------------------------------------------------ | | `AGENTBRIDGE_BASE_URL` | Base URL for the instance, for example `http://localhost:3000` or a disposable preview URL. | | `AGENTBRIDGE_COMPANY_TOKEN` | Company bearer token for the target company. Use a test/disposable token and never paste it into logs. | -| `AGENTBRIDGE_AGENT_ID` | AgentId that belongs to the target company and project. | +| `AGENTBRIDGE_AGENT_ID` | API-facing AgentId sent in the `AgentId` header. The script resolves its database UUID from `/api/agent` before task creation. | | `AGENTBRIDGE_PROJECT_ID` | Project ID where the disposable smoke task can be created and updated. | ```bash @@ -215,7 +215,7 @@ corepack pnpm smoke:saas-production Expected result: - `GET /api/health` returns HTTP `200` and `checks.database: "ok"`. -- `GET /api/agent` returns the configured agent profile. +- `GET /api/agent` returns the configured agent profile and provides the database UUID used as `assignedAgentId` for task creation. - Agent API task create/list/update all return success. - Console output ends with `PASS smoke-saas-production taskId=`. diff --git a/scripts/smoke-saas-production.ts b/scripts/smoke-saas-production.ts index 6a81492..6d17039 100644 --- a/scripts/smoke-saas-production.ts +++ b/scripts/smoke-saas-production.ts @@ -93,16 +93,16 @@ async function main() { const agentResult = await requestJson(config, "/api/agent") assertStatus(agentResult.response, agentResult.body, 200, "agent profile") - assert.equal( - (agentResult.body.agent as JsonRecord | undefined)?.AgentId, - config.agentId - ) + const agentProfile = agentResult.body.agent as JsonRecord | undefined + assert.equal(agentProfile?.AgentId, config.agentId) + assert.equal(typeof agentProfile?.id, "string") + const assignedAgentId = agentProfile.id const createResult = await requestJson(config, "/api/agent/tasks", { method: "POST", body: JSON.stringify({ projectId: config.projectId, - assignedAgentId: config.agentId, + assignedAgentId, name: taskName, job: "Disposable task created by the scripted SaaS production smoke check.", status: "todo",