File Processing Guide
Attach files to agent runs, reuse uploaded artifacts, and manage chunk IDs for long-form analysis. Reach for this guide when agents need to consume documents, transcripts, or datasets across REST, the Python SDK, and the CLI.
Upload Files with an Agent Run
When to use: Collect fresh documents from users or pipelines and supply them during execution.
from glaip_sdk import Client
client = Client()
agent = client.agents.get_agent_by_id("analysis-agent")
response = client.agents.run_agent(
agent.id,
"Summarise the document and extract key metrics",
files=["./reports/q1.pdf", "./reports/q2.pdf"],
)
print(response)aip agents run analysis-agent \
--input "Summarise these reports" \
--file reports/q1.pdf \
--file reports/q2.pdf \
--view json > summary.jsoncurl -X POST "$AIP_API_URL/agents/$AGENT_ID/run" \
-H "X-API-Key: $AIP_API_KEY" \
-F "input=Summarise these reports" \
-F "files=@reports/q1.pdf" \
-F "files=@reports/q2.pdf"Common upload errors
413 Payload Too Large
File exceeds backend upload limits.
Compress the file, split it into smaller chunks, or raise the limit with the platform team.
Missing file in run logs
File path incorrect or permissions denied.
Double-check the path, ensure the process can read the file, or use absolute paths.
Duplicate chunks created
Upload run without reusing artifact_id.
Pass the stored chunk IDs using the reuse workflows in the next section.
Unsupported media type errors
File type not allowed for ingestion.
Convert to a supported format (PDF, TXT, DOCX) or register a custom ingestion pipeline.
Reuse Uploaded Chunks
When to use: Avoid re-ingesting the same files while keeping chunk IDs stable across runs.
When the backend returns chunk_ids, store them for later runs:
Retrieve Artifacts and Output
When to use: Capture the processed results, enriched files, or generated reports after execution.
Best Practices
When to use: Create organisation-wide guardrails for storage, retention, and compliance.
Compress large files — keep uploads efficient and within platform limits.
Track chunk IDs — store them alongside run metadata so you can reference prior uploads without retransmitting data.
Sanitise inputs — redaction or PII masking should occur before uploading sensitive documents; see the Security & privacy guide.
Automate clean-up — if you are storing artifacts locally for auditing, ensure rotation policies are in place.
Related Documentation
Agents guide — streaming behaviour and runtime overrides.
Automation & scripting — capture outputs in CI pipelines.
Configuration management — export/import agents that rely on file workflows.
Last updated