Skip to main content
Non-streaming returns complete agent responses in a single call, waiting for the entire response to be generated before returning it. This is the default mode for agent interactions and is ideal when you need the full response before processing, building batch workflows, or integrating with systems that expect complete responses. Unlike streaming, which provides incremental updates as content is generated, non-streaming delivers everything at once, making it simpler to work with but requiring you to wait for the complete response.

Basic Usage

Use the run() method for synchronous calls or arun() for asynchronous calls:
from hypertic.agents import Agent
from hypertic.tools import tool
from hypertic.models import OpenAIChat

@tool
def get_date() -> str:
    """Get today's date."""
    from datetime import date
    return str(date.today())

model = OpenAIChat(model="gpt-5.2")

agent = Agent(
    model=model,
    tools=[get_date]
)

# Get complete response in one call
response = agent.run("What is today's date?")
print(response.content)
Output:
{'content': "Today's date is **January 3, 2026**.", 'metadata': {'model': 'gpt-5.2', 'params': {}, 'finish_reason': 'stop', 'input_tokens': 45, 'output_tokens': 20}, 'tool_calls': [{'id': 'call_abc123', 'function': {'arguments': '{}', 'name': 'get_date'}, 'type': 'function'}], 'tool_outputs': {'get_date': '2026-01-03'}}

Accessing Response Attributes

Access individual attributes of the response object:
from hypertic.agents import Agent
from hypertic.tools import tool
from hypertic.models import OpenAIChat

@tool
def get_date() -> str:
    """Get today's date."""
    from datetime import date
    return str(date.today())

model = OpenAIChat(model="gpt-5.2")
agent = Agent(
    model=model,
    tools=[get_date],
)

# Complete response after all tool calls
response = agent.run("What is today's date?")
print(f"Final response: {response.content}")
print(f"Final tool calls: {response.tool_calls}")
print(f"Final tool outputs: {response.tool_outputs}")
print(f"Final metadata: {response.metadata}")
Output:
Final response: Today's date is **January 3, 2026**.
Final tool calls: [{'id': 'call_hfILfptb7ECIkkgYAA3YPqKN', 'function': {'arguments': '{"day":"today"}', 'name': 'get_date'}, 'type': 'function'}]
Final tool outputs: {'get_date': '2026-01-03'}
Final metadata: {'model': 'gpt-5.2', 'params': {}, 'finish_reason': 'stop', 'input_tokens': 664, 'output_tokens': 34}

Response Structure

The non-streaming response object contains:
AttributeTypeDescription
contentstrThe final text response from the agent
tool_callslist[dict]All tool calls made during execution
tool_outputsdict[str, Any]Results from all tool executions
metadatadictModel info, parameters, finish reason, token usage