Quickstart Guide
This guide will help you get started with creating and using different types of agents in our platform.
Prerequisites
- Valid authentication token
- Access to the API endpoints
- Appropriate permissions (READ, CREATE, EDIT, INVOKE, DELETE)
Creating Your First Agent
- Tool Agent
- RAG Agent
- Task Agent
Currently, only these tools are supported out of the box:
multiply: Basic calculator multiplication functionstructured_output: Force JSON output.
Tool agents can perform specific tasks using predefined tools. Here are common examples:
Basic Calculator Agent
{
"name": "Calculator",
"description": "Math assistant",
"agentType": "tool",
"config": {
"tools": [
{
"toolType": "function",
"name": "multiply",
"description": "Multiplies two numbers",
"funcName": "multiply"
}
],
"llmModelId": "anthropic.claude-3-haiku-20240307-v1:0",
"systemPrompt": "You are a helpful assistant with access to various tools.",
"inferenceConfig": {
"maxTokens": 4000
},
"guardrails": ["HAIP-Prompt_attack-Medium"]
}
}
Structured Output Agent
Structured Output on Tool Agent is currently an experimental feature. The API and functionality may change in future releases.
{
"name": "PersonExtractor",
"description": "Extracts structured information about people",
"agentType": "tool",
"config": {
"tools": [
{
"toolType": "structured_output",
"name": "structured_output",
"description": "Extracts structured information about a person from text",
"outputSchema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Full name of the person"
},
"age": {
"type": "integer",
"description": "Age of the person"
},
"occupation": {
"type": "string",
"description": "Person's job or profession"
}
},
"required": ["name"]
}
}
],
"llmModelId": "anthropic.claude-3-sonnet-20240229-v1:0",
"systemPrompt": "You are a helpful assistant specialized in extracting structured information about people from text.",
"inferenceConfig": {
"maxTokens": 4000,
"temperature": 0.1
},
"guardrails": ["HAIP-Profanity"]
}
}
Example usage:
POST /v1/agents/{agent_id}/versions/{version_id-or-latest}/invoke
{
"messages": [
{
"role": "user",
"content": "John Doe is a 35-year-old software engineer"
}
]
}
Expected response:
{
"name": "John Doe",
"age": 35,
"occupation": "software engineer"
}
RAG (Retrieval-Augmented Generation) agents are perfect for document search and Q&A:
{
"name": "DocumentHelper",
"description": "Document assistant",
"agentType": "rag",
"notes": "Agent for document queries",
"config": {
"hxqlQuery": "SELECT * FROM SysContent",
"llmModelId": "amazon.nova-micro-v1:0"
}
}
To query the RAG agent:
POST /v1/agents/{agent_id}/versions/{version_id-or-latest}/invoke
{
"messages": [
{
"role": "user",
"content": "What's in our HR policy about vacation days?"
}
],
"hxqlQuery": "SELECT * FROM SysContent",
"guardrails": ["HAIP-Hate-High"]
}
Task Agents (structured input) are a helper wrapper built on top of Tool Agents to process structured inputs with schema validation and template rendering:
{
"name": "Document Classifier",
"description": "Classifies documents based on content",
"agentType": "task",
"config": {
"llmModelId": "anthropic.claude-3-haiku-20240307-v1:0",
"systemPrompt": "Classify the document titled '{{title}}' with content: {{content}}. Provide a category and confidence score.",
"inputSchema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Document title"
},
"content": {
"type": "string",
"description": "Document content to classify"
}
},
"required": ["title", "content"]
},
"tools": [
{
"toolType": "structured_output",
"name": "structured_output",
"description": "Extracts classification results from the document",
"outputSchema": {
"type": "object",
"properties": {
"category": { "type": "string", "description": "Predicted category of the document" },
"confidence": { "type": "number", "description": "Confidence score (0-1)" }
},
"required": ["category", "confidence"]
}
}
],
"inferenceConfig": {
"maxTokens": 1000,
"temperature": 0.1
},
"guardrails": ["HAIP-Profanity"]
}
}
To invoke the Task agent:
POST /v1/agents/{agent_id}/invoke-task
{
"inputs": {
"title": "Financial Report Q3",
"content": "Revenue increased by 15% compared to last quarter..."
},
"guardrails": ["HAIP-Insults-High"]
}
The main difference between Task and Tool Agents is the prompt which is now a template that gets populated with the inputs.
"systemPrompt": "Classify the document titled '{{title}}' with content: {{content}}. Provide a category and confidence score.",
Streaming Responses
Our platform supports streaming responses for all agent types (Tool, RAG, and Task Agents), allowing you to receive data incrementally as it's generated. This is particularly useful for long-running operations or when you want to display results to users in real-time.
Streaming Endpoints
- RAG and Tool Agents:
POST /v1/agents/{agent_id}/versions/{version_id-or-latest}/invoke-stream - Task Agents:
POST /v1/agents/{agent_id}/versions/{version_id-or-latest}/invoke-task-stream
Understanding the Stream
When you invoke the streaming endpoints, the server will send back a sequence of data chunks with the appropriate format based on the agent type.
- For Tool Agent and Task Agent streams, the system uses
text/plaincontent type. - For RAG Agent streams, the system uses
text/event-streamcontent type.
In all cases, each line in the response body is a self-contained JSON object, followed by a newline character. The stream is terminated by a special chunk with type response.completed
Processing Streamed Data
To process the stream, your client should:
- Open a connection to the streaming endpoint.
- Read the response line by line.
- Parse the line as a JSON object
- If a chunk has type
response.completed, close the connection. - Each JSON object (chunk) is either a
Created,Completed,TextDelta, orToolCallchunk, determined by the value oftypefield. - Extracting CreatedChunk: The
CreatedChunkobject has typeresponse.createdand signals the start of the streaming response. It has anid, and all subsequent chunks will have the same id.// Example created chunk
{
{"type": "response.created", "response": {"id": "resp_id", "model": "LLM-model-id", "object": "response", "createdAt": 1760631101}},
// ...
} - Extracting Content: The
TextDeltaobject has typeresponse.output_text.deltaand contains adeltafield with a segment of the text response. You should append these segments together to form the complete message.// Example chunk with text delta
{
{"type": "response.output_text.delta", "role": "assistant", "delta": "The result of 3x5 is ", "id": "resp_id"},
// ...
} - Extracting Tool Calls: The
ToolCallChunkobject has typeresponse.function_call_arguments.done.// Example chunk for tool call
{
{"type": "response.function_call_arguments.done", "name": "multiply", "itemId": "tool_123", "arguments": "{\"a\": 3, \"b\": 5}", "id": "resp_id"},
// ...
} - Extracting CompletedChunk: The
CreatedChunkobject has typeresponse.completedand signals the end of the streaming response. It may havecustomOutputswithsourceNodesfrom the request.// Example completed chunk with sourceNodes
{
{"type": "response.completed", "response": {"id": "resp_id", "model": "LLM-model-id", "object": "response", "createdAt": 1760631101, "customOutputs":{"sourceNodes":[{"id":"source-node-id","text":"source node text","score":0.05,"objectId":"object-id","chunkId":"chunk-id"}],"ragMode":"normal"}}},
// ...
}
Example: Streaming with a Tool Agent (using cURL)
Let's say you have a Tool Agent (like the Calculator example) with ID your-tool-agent-id and using the most recent version of config.
Request:
curl -N -X POST "http://your-api-base-url/v1/agents/your-tool-agent-id/versions/latest/invoke-stream" \\
-H "Authorization: Bearer your-jwt-token" \\
-H "Content-Type: application/json" \\
-d '{
"messages": [
{
"role": "user",
"content": "What is 3x5?"
}
]
}'
Expected Response Stream (raw text/plain lines):
{"type": "response.created", "response": {"id": "resp-id", "model": "LLM model ID", "object": "response", "createdAt": 1760632921}}
{"type": "response.output_text.delta", "role": "assistant", "delta": "Okay, I can help", "id": "resp-id"}
{"type": "response.output_text.delta", "role": "assistant", "delta": " with that. ", "id": "resp-id"}
{"type": "response.function_call_arguments.done", "id": "resp-id", "arguments": "{\"a\": 3, \"b\": 5}", "itemId": "tooluse_abc", "name": "multiply"}
{"type": "response.output_text.delta", "role": "assistant", "delta": "The result of 3 x 5", "id": "resp-id"}
{"type": "response.output_text.delta", "role": "assistant", "delta": "is 15.", "id": "resp-id"}
{"type": "response.completed", "response": {"id": "resp-id", "model": "LLM model ID", "object": "response", "createdAt": 1760632921}}
(Note: The exact chunking and content can vary. Some chunks might have empty content.)
Processing the above stream would yield:
- Aggregated Content:
"Okay, I can help with that. The result of 3 x 5 is 15." - Tool Call:
{
"item_id": "tooluse_abc",
"name": "multiply",
"arguments": "{\"a\": 3, \"b\": 5}"
}
Example: Streaming with a RAG Agent (using cURL)
For a RAG Agent with ID your-rag-agent-id and the most recent version of the config.
Request:
curl -N -X POST "http://your-api-base-url/v1/agents/your-rag-agent-id/versions/latest/invoke-stream" \\
-H "Authorization: Bearer your-jwt-token" \\
-H "Content-Type: application/json" \\
-d '{
"messages": [
{
"role": "user",
"content": "What is our vacation policy?"
}
],
"hxqlQuery": "SELECT * FROM SysContent",
}'
Expected Response Stream (raw text/plain lines):
{"type":"response.created","response":{"id":"44de5f46-1ad8-4d26-ab5a-46a928cdaa3f","model":"amazon.nova-micro-v1:0","object":"response","createdAt":1760631101}}
{"type":"response.output_text.delta","role":"assistant","delta":"Our vacation policy states that","id":"44de5f46-1ad8-4d26-ab5a-46a928cdaa3f"}
{"type":"response.output_text.delta","role":"assistant","delta":" employees are entitled to X days","id":"44de5f46-1ad8-4d26-ab5a-46a928cdaa3f"}
{"type":"response.completed","response":{"id":"44de5f46-1ad8-4d26-ab5a-46a928cdaa3f","model":"amazon.nova-micro-v1:0","object":"response","createdAt":1760631104,"customOutputs":{"sourceNodes":[{"id":"source-node-id","text":"source node text","score":0.05,"objectId":"object-id","chunkId":"chunk-id"}],"ragMode":"normal"}}}
Processing the above stream would yield:
- Aggregated Content:
"Our vacation policy states that employees are entitled to X days"
When using streaming, ensure your client correctly handles line endings and JSON parsing for each chunk. Remember that tools like Swagger UI may not display streaming responses correctly; cURL, Postman (with appropriate settings), or custom client code are better choices.