Steer
Force an answer
Force a running agent to give its final answer on the next step.
POST
/
api
/
v2
/
sessions
/
{id}
/
force_answer
from hai_agents import Client
client = Client()
client.sessions.force_session_answer(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.forceSessionAnswer({ id: sessionId });
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/force_answer \
-H "Authorization: Bearer $HAI_API_KEY"
Behavior
The call injects aforce_answer flow-control event, and the agent answers from the context it has so far.
- Each running subagent is asked to wrap up and gets about 30 seconds. Any that don’t finish are cancelled. Their partial results fold into the manager’s answer, and the cascade repeats through deeper subagents.
- A
queuedsession buffers the event and delivers it when the agent starts. - A finished session restarts, as with sending a message, and the relaunched agent answers immediately.
Path parameters
string
required
The session ID.
Response
202 Accepted. The command is delivered asynchronously.
from hai_agents import Client
client = Client()
client.sessions.force_session_answer(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.forceSessionAnswer({ id: sessionId });
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/force_answer \
-H "Authorization: Bearer $HAI_API_KEY"
Errors
| Status | Cause |
|---|---|
404 | Not found, or not in your organization. |
Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
client.sessions.force_session_answer(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.forceSessionAnswer({ id: sessionId });
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/force_answer \
-H "Authorization: Bearer $HAI_API_KEY"