Skip to main content
POST
/
document
/
agent
Deploy an autonomous AI agent into a document
curl --request POST \
  --url https://apigcp.trynia.ai/v2/document/agent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source_id": "<string>",
  "query": "<string>",
  "json_schema": {},
  "model": "claude-opus-4-6-1m",
  "thinking_enabled": true,
  "thinking_budget": 10000,
  "stream": false
}
'
{
  "answer": "<string>",
  "model": "<string>",
  "citations": [
    {
      "content": "<string>",
      "tool_source": "<string>",
      "page_number": 123,
      "section_id": "<string>",
      "section_title": "<string>",
      "section_path": [
        "<string>"
      ]
    }
  ],
  "structured_output": {},
  "usage": {}
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json

Request to deploy an autonomous document agent. The agent researches the document using tools and supports structured output via json_schema.

source_id
string
required

Data source ID of the indexed document

query
string
required

Question to ask about the document

Required string length: 1 - 10000
json_schema
Json Schema · object

JSON Schema for structured output. When provided, the agent returns a structured_output field conforming to this schema.

model
string
default:claude-opus-4-6-1m

Model to use (claude-opus-4-6-1m, claude-opus-4-6, claude-sonnet-4-5-20250929, etc.)

thinking_enabled
boolean
default:true

Enable extended thinking for more thorough analysis

thinking_budget
integer
default:10000

Token budget for thinking (ignored for adaptive models like Opus 4.6)

Required range: 1000 <= x <= 50000
stream
boolean
default:false

Stream response as SSE events

Response

Successful Response

answer
string
required

The agent's comprehensive answer with inline citations

model
string
required

Model used for the response

citations
DocumentCitation · object[]

Citations from the document with page numbers and section paths

structured_output
Structured Output · object

Structured data conforming to the provided json_schema (only present when json_schema was provided)

usage
Usage · object

Token usage statistics