Documentation Index
Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
AgentInput is the input object your agent receives when using the Structured signature ((input_data: AgentInput) -> AgentResponse). It provides the conversation history, session context, and helper methods for accessing user messages.
When a test case has structured JSON input (e.g. {"user_message": "hello", "chat_type": "support"}), the SDK splits it: user_message becomes the message content, and the remaining fields (like chat_type) are placed in the first user message’s metadata.
Fields
The full conversation history up to this turn. Each
ConversationMessage has:role(str):"user"or"assistant"content(str): The message textretrieval_context(Optional[str]): Retrieved context (for RAG agents)metadata(Optional[dict[str, Any]]): Additional fields. When the test case uses structured JSON input, non-message fields (e.g.chat_type,priority) appear here on the first user message.
The current session identifier. Use this to maintain state in stateful agents.
Structured context data from the test case. This comes from the test case’s
context / context_data field, not from the input. Use it to pass supplemental information like customer tier, environment, or domain context.Additional metadata for the current execution.
The inference result ID for this execution. Forward this to remote agents so they can attach traces to the correct session via
set_context(inference_result_id=...). See Remote Agent Tracing.Helper Methods
Returns the
content of the last user message, or None if no user message exists. This is the simplest way to get the user’s message text.Returns the full
ConversationMessage object for the last user message (with role, content, retrieval_context, and metadata), or None if not found. Use this when you need access to the message’s metadata.Basic Usage
Accessing Structured Input Fields
When your test case input is a JSON object (e.g. uploaded via CSV with{"user_message": "hello", "chat_type": "support"} in the input column), the SDK places user_message as the message content and remaining fields in messages[0].metadata:
Accessing Context Data
context_data is separate from the input. It comes from the test case’s context field and is useful for passing supplemental information that is not part of the user message:
Structured Input on TestCase and InferenceResult
Outside ofAgentInput, the TestCase and InferenceResult models provide two fields for accessing input:
.input(str): Theuser_messagevalue as a plain string.input_data(dict): The full structured input object with all fields
How Structured Input Flows Through the System
- Test case CSV: You provide JSON in the
inputcolumn:{"user_message": "hello", "chat_type": "support"} - TestCase model:
.input="hello",.input_data={"user_message": "hello", "chat_type": "support"} - Endpoint templates: Use
{{ input.user_message }}or{{ input.chat_type }}to access individual fields, or{{ input }}for the full message - AgentInput (SDK):
messages[0].content="hello",messages[0].metadata={"chat_type": "support"} - InferenceResult:
.input="hello",.input_data={"user_message": "hello", "chat_type": "support"}
Related
Simulating Conversations
Multi-turn conversation simulation tutorial.
Generate Inference Result
Single-turn agent execution with automatic trace collection.
Templates & Mapping
Endpoint template syntax including
{{ input.field_name }}.Tracing Agent Operations
Capture internal operations and forward inference_result_id to remote agents.