import { CodeTabs } from '../views/docs/CodeTabs';
import { Callout, NextLink } from '../views/docs/prose';

## set_task()

`call.set_task()` directs the agent toward a new goal mid-call. It accepts an objective, an ordered checklist of steps, and a task ID for binding completion handlers.

export const SET_TASK_SIG_PY = `call.set_task(
    task_id: str,
    objective: str = "",
    checklist: list[Field | Say | str] | None = None,
    completion_criteria: str = "",
)`;

export const SET_TASK_SIG_TS = `await call.setTask({
  taskId: string,
  objective?: string,
  checklist?: (FieldItem | SayItem | string)[],
})`;

<CodeTabs
  python={{ code: SET_TASK_SIG_PY, filename: "signature" }}
  typescript={{ code: SET_TASK_SIG_TS, filename: "signature" }}
/>

<Callout>
  <span className="text-primary font-semibold">Full reference:</span> See the <a href="/docs/tasks" className="text-primary hover:underline">Task</a> page for parameter details, checklist item types, and a complete example.
</Callout>

<NextLink section="set-persona" label="set_persona()" />
