LLM Response • AI Agent SDK
llm_response: Emit LLM response event.
llm_response
Method
</div>
This is a method of the ContextTraceEmitter class in the context_events module.
Emit LLM response event.
Signature
def llm_response(agent_name: str, response_tokens: int, duration_ms: float, finish_reason: Optional[str], response_content: Optional[str], prompt_tokens: int, completion_tokens: int, cost_usd: float, model: Optional[str]) -> NoneParameters
ParamField
strName of the agent receiving the response
ParamField
intNumber of tokens in response (deprecated, use completion_tokens)
ParamField
floatResponse time in milliseconds
ParamField
Optional[str]Reason for completion (stop, length, etc.)
ParamField
Optional[str]Optional response content for context replay
ParamField
intNumber of tokens in the prompt/request
ParamField
intNumber of tokens in the completion/response
ParamField
floatEstimated cost in USD for this LLM call
ParamField
Optional[str]Model that served the call (stored as `data.model`)
Source
View on GitHubpraisonaiagents/trace/context_events.py at line 1046