Warning
This SDK is DEPRECATED
Create an agent response for a given message. Return the complete conversation including messages, tool interactions, and token usage.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.agents.responses.create(agent_key="<value>", message={
"role": "tool",
"parts": [],
}, identity={
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "jane.doe@example.com",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering",
],
}, thread={
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support",
"priority-high",
],
}, background=False, stream=False)
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)| Parameter | Type | Required | Description |
|---|---|---|---|
agent_key |
str | ✔️ | The unique key of identifier of the agent to invoke |
message |
models.A2AMessage | ✔️ | The A2A message to send to the agent (user input or tool results) |
task_id |
Optional[str] | ➖ | Optional task ID to continue an existing agent execution. When provided, the agent will continue the conversation from the existing task state. The task must be in an inactive state to continue. |
variables |
Dict[str, Any] | ➖ | Optional variables for template replacement in system prompt, instructions, and messages |
identity |
Optional[models.AgentResponseRequestIdentity] | ➖ | Information about the identity making the request. If the identity does not exist, it will be created automatically. |
contact |
Optional[models.Contact] | ➖ | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. @deprecated Use identity instead. Information about the contact making the request. |
thread |
Optional[models.AgentResponseRequestThread] | ➖ | Thread information to group related requests |
memory |
Optional[models.AgentResponseRequestMemory] | ➖ | Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions. |
metadata |
Dict[str, Any] | ➖ | Optional metadata for the agent invocation as key-value pairs that will be included in traces |
engine |
Optional[models.Engine] | ➖ | Override template engine for this invocation. If not provided, uses the agent default. |
configuration |
Optional[models.AgentResponseRequestConfiguration] | ➖ | Configuration options for the agent invocation |
background |
Optional[bool] | ➖ | If true, returns immediately without waiting for completion. If false (default), waits until the agent becomes inactive or errors. |
stream |
Optional[bool] | ➖ | If true, returns Server-Sent Events (SSE) streaming response with real-time events. If false (default), returns standard JSON response. |
conversation |
Optional[models.Conversation] | ➖ | Conversation context for chat studio integration |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.CreateAgentResponseRequestResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.APIDefaultError | 4XX, 5XX | */* |
Retrieve an agent response by task ID, including output, model info, token usage, and execution status.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.agents.responses.get(agent_key="<value>", task_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
agent_key |
str | ✔️ | The unique key identifier of the agent |
task_id |
str | ✔️ | The agent execution task ID returned from create response |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.HonoAPIError | 404 | application/json |
| models.APIDefaultError | 4XX, 5XX | */* |