Contextual AI integration
Contextual AI builds grounded retrieval-augmented (RAG) agents over your own documents. With this API an agent can create and configure datastores, ingest documents (PDF, HTML, Word, PowerPoint, PNG, JPG) and read their ingestion status, parse results, chunks and metadata, create, configure, copy, reset and query Contextual agents (including Agent Composer workflows) and get answers with retrieved sources, attributions and groundedness scores, record feedback and read agent metrics, and call the standalone component APIs: parse a file into Markdown or JSON blocks, rerank documents for a query, generate a grounded answer from given knowledge, score a response against a natural-language unit test (LMUnit), and run JSON-Schema structured extraction on PDFs. Queries, parsing, reranking, generation, LMUnit and extraction are billed to the Contextual AI account (component prices: contextual.ai/pricing). Workspace administration (users, consent, billing and usage reports) and the streaming variants are not exposed. Authentication is a Contextual AI API key sent as a Bearer token.
Say what should happen.
The workflow builds itself.
What you can do with Contextual AI
Each of these is one operation on one endpoint, available both as a workflow step and as a tool an AI agent can call on its own. Nothing bundles several operations into one action, so what a run did stays readable afterwards.
Most endpoints run on the free plan. A few, mainly the ones that publish on your behalf, need a paid plan.
Agent, 8 operations
copy_agentCopy agentPOSTCopies an agent with all its configuration and datastore links; the copy's name gets [COPY] appended. Returns the new agent's id and datastore ids.create_agentCreate agentPOSTCreates a RAG agent grounded on the given datastore_ids, from a template (default, finance, customer_support, company_policy_q_and_a or a saved custom template) plus optional prompts and agent_configs. Returns its id.delete_agentDelete agentDELETEPermanently deletes an agent. Its datastores are kept, even when no other agent uses them; delete_datastore removes a datastore.get_agentGet agentGETReturns an agent's full configuration: name, description, datastore ids, template, system, filter, no-retrieval and multi-turn prompts, suggested queries and agent_configs (retrieval, rerank, generation, Agent Composer).list_agentsList agentsGETLists the workspace's agents: id, name and description. Pass next_cursor back as cursor to get the next page; limit is 1 to 1000 (default 1000).query_agentQuery agentPOSTSends the conversation to a Contextual agent and returns its grounded answer (message.content) with retrieved sources, attributions and groundedness scores. Pass conversation_id from an earlier answer to continue it.reset_agentReset agentPUTResets an agent to the default configuration, replacing the prompts and settings it has now. Read them with get_agent first if they may be needed again.update_agentUpdate agentPUTChanges an agent's configuration; fields left out are not modified. Use it to change prompts, linked datastore_ids, suggested queries or agent_configs. Read the current values with get_agent first.
Document, 8 operations
delete_datastore_documentDelete datastore documentDELETEPermanently deletes a document from its datastore.delete_extract_documentDelete extract documentDELETEPermanently deletes a document uploaded for structured extraction.get_datastore_documentGet datastore documentGETReturns one datastore document: name, ingestion status (pending, processing, retrying, completed, failed, cancelled), creation and update times, custom metadata and its configuration.ingest_documentIngest documentPOSTIngests a file (PDF, HTML, DOC, DOCX, PPT, PPTX, PNG, JPG) into a datastore. Ingestion is asynchronous: poll get_datastore_document with the returned id until status is completed or failed.list_datastore_documentsList datastore documentsGETLists a datastore's documents with id, name and ingestion status; filter by status, upload time or name. Pass next_cursor back as cursor for the next page (limit 1 to 1000).list_extract_documentsList extract documentsGETLists the PDFs uploaded for structured extraction: document id, file name, size, page count, upload time and status. Page with cursor and limit (default 20).parse_fileParse filePOSTStarts a billed parse of a file (PDF, DOC, DOCX, PPT, PPTX, PNG, JPG; under 300 MB and 2000 pages) into Markdown or JSON blocks. Returns a job_id: poll get_parse_status, then call get_parse_results.rerank_documentsRerank documentsPOSTRanks a list of document texts by relevance to a query, then by your optional instruction, with Contextual's multilingual reranker. Billed per token: ctxl-rerank-v2-instruct-multilingual-mini is the cheaper model.
Datastore, 6 operations
create_datastoreCreate datastorePOSTCreates a datastore, a collection of documents agents retrieve from, with optional parsing and chunking configuration. Self-serve accounts must create datastores in the Contextual UI; the API then refuses.delete_datastoreDelete datastoreDELETEPermanently deletes a datastore and every document ingested into it. Fails with 400 while an active agent is still linked to it.get_datastoreGet datastoreGETReturns a datastore's details: name, type, parsing and chunking configuration, creation time, the agents that use it and its usage.list_datastoresList datastoresGETLists the workspace's datastores (collections of documents): id, name, type, configuration and creation time. Filter by agent_id; pass next_cursor back as cursor for the next page (limit 1 to 1000).reset_datastoreReset datastorePUTResets a datastore: permanently and irreversibly deletes every document in it; the datastore itself is kept.update_datastoreUpdate datastorePUTRenames a datastore or changes its parsing and chunking configuration; a field left out keeps its current value.
Schema, 3 operations
delete_extraction_schemaDelete extraction schemaDELETEPermanently deletes an extraction schema.list_extraction_schemasList extraction schemasGETLists extraction schemas with id, name, description and JSON Schema definition. Filter with search; page with cursor and limit (default 20).update_extraction_schemaUpdate extraction schemaPUTChanges an extraction schema's name, description, JSON Schema definition or metadata; a field left out keeps its current value.
Template, 3 operations
get_templateGet templateGETReturns the configuration of a template, built-in (default, finance, customer_support, company_policy_q_and_a) or custom: prompts, suggested queries and agent_configs, the same shape as get_agent.list_templatesList templatesGETLists the names of the agent templates available to the workspace, for create_agent's template_name and get_template.save_agent_templateSave agent templatePOSTSaves an agent's configuration as a custom template under the given name; custom template names can then be passed to create_agent (template_name) and get_template.
Content, 2 operations
get_content_metadataGet content metadataGETReturns one content chunk's metadata: content_type (unstructured, structured, file_analysis or contextual_agent_response), its text, page, bounding box, page image and document id where they apply.list_datastore_contentsList datastore contentsGETLists the content chunks of a datastore, optionally of one document_id or matching a keyword search: content id, type, page number, and table and schema names for structured content.
Extract document, 2 operations
get_extract_documentGet extract documentGETReturns one extraction document: file name, size, page count, upload time, status and a signed download URL valid for one hour (GCS and S3 storage only).upload_extract_documentUpload extract documentPOSTUploads a PDF (recommended at most 50 MB) for structured extraction and returns its document_id, file name, size and page count, for start_extraction_job.
Extraction job, 2 operations
get_extraction_jobGet extraction jobGETReturns an extraction job's status (pending, processing, completed, failed, cancelled) and progress: percentage, current step, fields processed. When completed, read get_extraction_results.start_extraction_jobStart extraction jobPOSTStarts a billed structured extraction of a PDF (from upload_extract_document) against a JSON Schema (from create_extraction_schema). Returns a job_id: poll get_extraction_job, then read get_extraction_results.
Extraction result, 2 operations
get_extraction_resultsGet extraction resultsGETReturns the data extracted by a completed job, shaped by its JSON Schema, plus processing metadata and the configuration used (and per-field attributions when per_key_attribution was on).update_extraction_resultsUpdate extraction resultsPUTReplaces the stored results of a completed extraction job with corrected data that conforms to its JSON Schema.
Extraction schema, 2 operations
create_extraction_schemaCreate extraction schemaPOSTCreates an extraction schema: a JSON Schema (2020-12 subset, root type object) describing the data to extract from documents. Returns schema_id for start_extraction_job.get_extraction_schemaGet extraction schemaGETReturns one extraction schema: name, description, JSON Schema definition, metadata and timestamps.
Parse job, 2 operations
get_parse_statusGet parse statusGETReturns a parse job's status (pending, processing, retrying, completed, failed or cancelled) and file name; call get_parse_results once it is completed. Jobs older than 30 days answer 404.list_parse_jobsList parse jobsGETLists parse jobs from the last 30 days (or since uploaded_after), newest first: job id, status and file name. Pass next_cursor back as cursor for the next page (limit 1 to 1000).
Parse result, 2 operations
get_document_parse_resultsGet document parse resultsGETReturns the parse results produced when a datastore document was ingested, in the output_types asked for. Documents ingested before this feature existed answer 404.get_parse_resultsGet parse resultsGETReturns a parse job's output in the output_types asked for: Markdown of the whole file, Markdown per page and or JSON blocks per page with hierarchy. Results are kept 30 days.
Agent composer, 1 operation
query_agent_composerQuery agent composerPOSTQueries an agent through its Agent Composer workflow (the YAML in agent_configs.acl_config) and returns the answer plus the workflow outputs, workflow_trace and dynamic_agent_trace (tool calls, reasoning).
Agent composer template, 1 operation
list_agent_composer_templatesList agent composer templatesGETLists the available Agent Composer templates (prebuilt workflow agents): id, name, description, badges, the template_name to use and the Agent Composer config name.
Agent metrics, 1 operation
get_agent_metricsGet agent metricsGETReturns an agent's logged messages with usage and user feedback, at most two days at a time (created_after to created_before). The messages hold what users asked and received and can be filtered by user email: personal data.
Chunk, 1 operation
edit_chunk_contentEdit chunk contentPUTReplaces the text of one chunk of a datastore and regenerates its embeddings, so retrieval uses the new text.
Document metadata, 1 operation
update_document_metadataUpdate document metadataPUTSets a document's custom metadata, which enriches its chunks in the context or only serves filtering (start a key with _ for filter-only). Read the current values with get_datastore_document first.
Feedback, 1 operation
provide_feedbackProvide feedbackPOSTRecords feedback on one answer or one retrieved content of an agent: thumbs_up, thumbs_down, flagged, or removed to undo earlier feedback. Shown on the Feedback page of the Contextual UI.
Job, 1 operation
list_extraction_jobsList extraction jobsGETLists structured extraction jobs with status, progress, schema, document and configuration. Filter by job_status or search; page with cursor and limit (default 20).
Response, 1 operation
generate_grounded_responseGenerate grounded responsePOSTGenerates an answer from Contextual's Grounded Language Model, faithful to the knowledge passages you send rather than its own knowledge. Billed per token; the whole request is limited to 32,000 tokens.
Retrieval info, 1 operation
get_retrieval_infoGet retrieval infoGETReturns metadata of the contents an answer was built from: per content its page, bounding box, page image, text and document id. Pass the answer's message_id and the content_ids from its retrieval_contents.
Unit test, 1 operation
score_lmunit_testScore lmunit testPOSTScores a response against a natural-language unit test with LMUnit, on a continuous 1 to 5 scale, given the query, the response and the test. Total input at most 7000 tokens; billed per input token.
Use Contextual AI from Claude Code, Cursor or Codex
Connect Contextual AI in LiveContext, create an API key in Settings, then add the LiveContext MCP server to your client. Its Contextual AI operations become tools the client can call, next to every other integration you connected.
claude mcp add --transport http livecontext https://livecontext.ai/mcp --header "X-API-Key: YOUR_API_KEY"[mcp_servers.livecontext]
url = "https://livecontext.ai/mcp"
[mcp_servers.livecontext.http_headers]
"X-API-Key" = "YOUR_API_KEY"{
"mcpServers": {
"livecontext": {
"type": "http",
"url": "https://livecontext.ai/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}How to connect Contextual AI
- Create your workspace
Sign up free. Nothing to install.
- Connect Contextual AI once
Add your Contextual AI connection in Settings. Every tool from this integration reuses it, and secrets are encrypted at rest and visible only to you.
- Describe the job in chat
The workflow builds itself in front of you and picks the endpoints it needs. Drag the steps yourself on the canvas whenever you would rather be explicit.
Contextual AI integration FAQ
What can you do with the Contextual AI integration?
LiveContext exposes 52 operations on Contextual AI, covering agent, document, datastore and schema.
