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

await platic.agents.files.connect("agent_123", "file_123");

Path parameters

ParameterTypeDescriptionRequired
agentIdstringAgent id✓
fileIdstringFile 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

Statusdetails.codeWhen
403RESOURCE_NOT_ACCESSIBLEIntegrations is missing or you can't edit the agent.
404AGENT_NOT_FOUNDThe agent doesn't exist or belongs to another workspace.
404RESOURCE_NOT_ACCESSIBLEThe file doesn't exist in this workspace.
409FILE_NOT_READYThe 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 200 and 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.