Connect a file
SDK platic.agents.files.connect()
Connect an existing file so an agent can use it. Send agentId and fileId in the URL, with no body. The connection applies immediately, without publishing, and does not create a version.
Example
curl -X PUT https://api.platic.ai/v1/agents/$AGENT_ID/files/$FILE_ID \
-H "Authorization: Bearer $PLATIC_API_KEY" await platic.agents.files.connect("agent_123", "file_123"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
agentId | string | Agent id | ✓ |
fileId | string | File id | ✓ |
Request body
No body.
Response
201 Created with the new connection, or 200 OK with the one that already existed, unchanged:
{
"status": "success",
"data": {
"agentId": "Lm4Rt8Wq2Zp6Yb1Nc3Vd",
"fileId": "fH3kL9mQ2xR7",
"state": "active",
"attachedAt": "2026-11-01T12:30:00.000Z",
"activateOnReady": false,
"schedule": null
}
} data is the connection, with the fields from List agent files.
Errors
| Status | details.code | When |
|---|---|---|
403 | RESOURCE_NOT_ACCESSIBLE | Integrations is missing or you can't edit the agent. |
404 | AGENT_NOT_FOUND | The agent doesn't exist or belongs to another workspace. |
404 | RESOURCE_NOT_ACCESSIBLE | The file doesn't exist in this workspace. |
409 | FILE_NOT_READY | The file doesn't have content ready or is being deleted. |
The ones that apply to all operations are in common errors.
Notes
- The file is shared with other agents; no copy is created. To create one already connected, use Create a file with
attachment.agentId. - It needs Integrations and being able to edit the agent.
- Connecting a file that is already connected answers
200and doesn't change its state. - In the SDK, you can connect it and leave it paused in a single call with
platic.agents.files.connect(agentId, fileId, { state: "paused" }). - For the agent to stop using it without losing the connection, use Pause or schedule a file. To remove it, Disconnect a file.
- From an AI agent, the tool is
connect_agent_file.