LiyaEngine Docs
API Reference

Agents

GET/POST /v1/agents, GET/PATCH/DELETE /v1/agents/{agentKey}, plus deploy, run, and run/session history — standalone Agents via API key.

Dashboard

Standalone Agents via API key — an orchestration layer that composes Intents/Workflows/Tools/Knowledge as capabilities. This is the same resource as the dashboard's Agent Runtime page and the same underlying service — creating or deploying an agent here shows up in the dashboard immediately, and vice versa.

List agents

GET https://api.liyaengine.ai/v1/agents
Authorization: Bearer liya_xxxxxxxxxxxx

Returns the flat catalog of this tenant's active agents, each with its callable endpoint — not the full agent config. Use GET /v1/agents/{agentKey} for that.

{
  "success": true,
  "data": {
    "agents": [
      {
        "agent": "support-triage",
        "displayName": "Support Triage",
        "description": null,
        "goal": "Triage incoming support tickets",
        "status": "active",
        "endpoint": "/v1/agents/support-triage/run",
        "method": "POST",
        "inputSchema": { "...": "..." }
      }
    ],
    "total": 1
  }
}

Create an agent

POST https://api.liyaengine.ai/v1/agents
Authorization: Bearer liya_xxxxxxxxxxxx
Content-Type: application/json

{
  "agent_key": "support-triage",
  "name": "Support Triage",
  "goal": "Triage incoming support tickets and route them to the right team.",
  "intent_ids": [],
  "workflow_ids": [],
  "knowledge_domain_keys": []
}

agent_key must be lowercase letters, numbers, hyphens, or underscores. Created in draft status — use the deploy endpoint below to activate it for execution. Returns 201 with { "data": { "agent": {...} } }, or 409 AGENT_KEY_TAKEN if the key is already used in this tenant, or 403 FEATURE_NOT_ENABLED if agentic tool-calling isn't enabled on your plan.

tools_config, memory_config, and behavior_config are optional nested objects — see Agent Orchestration for what each controls.

input_schema, output_schema and output_validation are optional too. They give an agent a typed contract; see Typed input and output below. An agent that sets none of them takes a free message and answers in text, exactly as before.

Get an agent

GET https://api.liyaengine.ai/v1/agents/{agentKey}
Authorization: Bearer liya_xxxxxxxxxxxx

Returns the full agent config, including effective_runtime_config — configured values merged with platform defaults, with each field's source (agent | platform_default | provider_default).

Update an agent

PATCH https://api.liyaengine.ai/v1/agents/{agentKey}
Authorization: Bearer liya_xxxxxxxxxxxx
Content-Type: application/json

{
  "name": "Support Triage v2",
  "model": "gpt-4o-mini"
}

All fields optional — only what you pass gets changed. Setting "status": "active" directly is rejected (409 DEPLOY_REQUIRED) — use the deploy endpoint instead.

Deploy an agent

POST https://api.liyaengine.ai/v1/agents/{agentKey}/deploy
Authorization: Bearer liya_xxxxxxxxxxxx

Activates the agent for execution — a deliberate, separately audited transition distinct from an ordinary update, so you can tell routine edits apart from publishing an agent live.

Delete an agent

DELETE https://api.liyaengine.ai/v1/agents/{agentKey}
Authorization: Bearer liya_xxxxxxxxxxxx

Soft delete — sets status to inactive. There's no separate active flag; inactive doubles as both "deleted" and "manually paused."

Run an agent

POST https://api.liyaengine.ai/v1/agents/{agentKey}/run
Authorization: Bearer liya_xxxxxxxxxxxx
Content-Type: application/json

{
  "input": { "message": "My order hasn't arrived yet." }
}
{
  "success": true,
  "data": {
    "run_id": "run_01HZ...",
    "session_id": "ses_01HZ...",
    "status": "completed",
    "output": "I've looked into your order...",
    "steps": 2,
    "total_cost": 0.0043,
    "total_latency_ms": 480
  }
}

Pass session_id to continue a prior conversation with this agent instead of starting a new one. Only an agent in active status can be run.

Typed input and output

An agent can declare a JSON Schema for what callers send and one for what it answers. Both are optional.

{
  "input_schema": {
    "type": "object",
    "required": ["requester_id", "ticket_id"],
    "properties": {
      "requester_id": {
        "type": "string",
        "x-trusted": true,
        "x-bind": [{ "tool": "intent_support_lookup_user", "param": "user_ref" }]
      },
      "ticket_id": { "type": "string" }
    },
    "additionalProperties": false
  },
  "output_schema": {
    "type": "object",
    "required": ["status", "requester_message"],
    "properties": {
      "status": { "enum": ["resolved", "clarify", "escalated"] },
      "requester_message": { "type": "string", "maxLength": 400 }
    }
  },
  "output_validation": "enforce"
}

Both schemas must have "type": "object" at the top, stay under 20,000 characters, and refer only to themselves ($ref values must start with #). A pattern is checked on every call against the caller's text, so one that could take exponential time is refused: keep patterns under 200 characters, with no backreferences and no repeated group that repeats or branches, such as (a+)+. Ordinary patterns for ids and codes, such as ^[A-Z]{2}-\d{6}$, are fine. A schema that is not valid JSON Schema is refused when you save the agent, with 400 INVALID_AGENT_SCHEMA and every problem listed. Send null to remove a schema. GET /v1/agents shows each agent's schemas.

Input

input is checked against the input schema before the run starts. A request that does not match is turned away with 400 INPUT_VALIDATION_FAILED and each problem listed, and nothing is run, recorded or charged:

{
  "success": false,
  "error": {
    "code": "INPUT_VALIDATION_FAILED",
    "message": "The input does not match this agent's input schema: /ticket_id is required.",
    "details": { "errors": [{ "path": "/ticket_id", "message": "is required" }] }
  }
}
  • message, user, user_id and vapi_caller are always accepted next to the declared fields, even with additionalProperties: false. message is always required.
  • Send the declared fields on every call. Each turn of a conversation is checked on its own.
  • Phone calls (Vapi and voice lines) are not checked.
  • The agent is shown the declared fields as data: fields marked "x-trusted": true as verified context from your system, which it relies on over what the user says, and the rest as request fields. Fields are not substituted into the instructions, so an instruction may refer to a field by name but never needs {{braces}}.
  • x-bind fills a parameter of one of the agent's tools from your request, so the model is not asked for it and cannot be talked into another value. It can name an attached intent, workflow or action tool, and the parameter must exist. This is how an identity your system vouches for reaches a lookup.

Output

The agent is told to finish with a JSON object that matches the output schema, and its answer is checked. If it does not match, the agent corrects it once, shown what its tools returned. The correction is one more model call, counted in total_cost. Phone calls ignore the output schema.

{
  "success": true,
  "data": {
    "run_id": "run_01HZ...",
    "status": "completed",
    "output": "{\"status\":\"resolved\",\"requester_message\":\"Your VPN profile is reset.\"}",
    "structured_output": { "status": "resolved", "requester_message": "Your VPN profile is reset." },
    "output_valid": true,
    "output_repairs": 1,
    "steps": 4,
    "total_cost": 0.0041
  }
}

output stays a string (the JSON text), so a client that only reads output keeps working. structured_output is the same answer as an object. output_repairs appears only when the answer was corrected.

What happens when an answer still does not match depends on output_validation:

output_validationResult
enforce (default)The run fails with 422 OUTPUT_SCHEMA_VIOLATION and error.details.errors. No answer is returned. The run is kept in its history with the answer as written.
warnThe answer is returned as written, with "output_valid": false and output_issues.

A reply that a guardrail withheld is never corrected, and fails as 422 GUARDRAIL_BLOCKED.

A schema checks the shape of an answer, not whether it is true. A model can fill a field it has no source for with a plausible value that fits the pattern. Take values from tool results, and use x-bind for identities, rather than relying on a pattern to catch a made-up value.

Run and session history

GET https://api.liyaengine.ai/v1/agents/{agentKey}/runs
GET https://api.liyaengine.ai/v1/agents/{agentKey}/runs/{runId}
GET https://api.liyaengine.ai/v1/agents/{agentKey}/sessions
GET https://api.liyaengine.ai/v1/agents/{agentKey}/sessions/{sessionId}/transcript

runs is a paginated list (page, pageSize, status, session_id query params); runs/{runId} returns one run's full step-by-step trace. sessions is one row per real conversation, not per turn; sessions/{sessionId}/transcript returns every turn of one conversation in chronological order.

Using an SDK

import { LiyaEngine } from '@liyaengine/sdk';

const client = new LiyaEngine({ apiKey: process.env.LIYA_API_KEY! });

const agent = await client.agents.create({
  agent_key: 'support-triage',
  name: 'Support Triage',
  goal: 'Triage incoming support tickets.',
});

await client.agents.deploy(agent.agent_key);

const result = await client.agents.run(agent.agent_key, {
  input: { message: "My order hasn't arrived yet." },
});

On this page