# Tasks ## Start **post** `/agent/tasks` Starts an agent task and returns a task_id immediately. ### Body Parameters - `agent_type: optional string` - `environment_id: optional string` - `instruction: optional string` - `kind: optional "desktop" or "browser"` - `"desktop"` - `"browser"` - `max_steps: optional number` - `model: optional string` - `persistent: optional boolean` - `screenshot_mode: optional "url" or "base64"` - `"url"` - `"base64"` - `temperature: optional number` - `viewport_height: optional number` - `viewport_width: optional number` ### Returns - `status: optional string` - `task_id: optional string` ### Example ```http curl https://api.tzafon.ai/agent/tasks \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $TZAFON_API_KEY" \ -d '{}' ``` ## Start Stream **post** `/agent/tasks/stream` Starts an agent task and streams events via SSE (Content-Type: text/event-stream). ### Body Parameters - `agent_type: optional string` - `environment_id: optional string` - `instruction: optional string` - `kind: optional "desktop" or "browser"` - `"desktop"` - `"browser"` - `max_steps: optional number` - `model: optional string` - `persistent: optional boolean` - `screenshot_mode: optional "url" or "base64"` - `"url"` - `"base64"` - `temperature: optional number` - `viewport_height: optional number` - `viewport_width: optional number` ### Example ```http curl https://api.tzafon.ai/agent/tasks/stream \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $TZAFON_API_KEY" \ -d '{}' ``` ## Retrieve Status **get** `/agent/tasks/{id}` Returns the current status/result for a task. ### Path Parameters - `id: string` ### Returns - `exit_code: optional number` - `status: optional string` - `task_id: optional string` ### Example ```http curl https://api.tzafon.ai/agent/tasks/$ID \ -H "Authorization: Bearer $TZAFON_API_KEY" ``` ## Inject Message **post** `/agent/tasks/{id}/messages` Injects a message into a running agent task. ### Path Parameters - `id: string` ### Body Parameters - `message: optional string` ### Returns - `status: optional string` ### Example ```http curl https://api.tzafon.ai/agent/tasks/$ID/messages \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $TZAFON_API_KEY" \ -d '{}' ``` ## Pause **post** `/agent/tasks/{id}/pause` Pauses a running agent task. ### Path Parameters - `id: string` ### Returns - `status: optional string` ### Example ```http curl https://api.tzafon.ai/agent/tasks/$ID/pause \ -X POST \ -H "Authorization: Bearer $TZAFON_API_KEY" ``` ## Resume **post** `/agent/tasks/{id}/resume` Resumes a paused agent task. ### Path Parameters - `id: string` ### Returns - `status: optional string` ### Example ```http curl https://api.tzafon.ai/agent/tasks/$ID/resume \ -X POST \ -H "Authorization: Bearer $TZAFON_API_KEY" ```