From your codeNo repository

Produce a report or file, no repo

A file you download

Send a request with no repository; the agent works in its own computer and returns a file as one of the session's artifacts.

View .md

Best for

  • Research, analysis and drafts that end in a document
  • Work on files you attach instead of a repository

Uses

  • An API key

From your code

POST /o/{org}/sessions
Request body
{
  "agent": "claude",
  "input": [
    {
      "type": "text",
      "text": "Compare these two vendor contracts and write a one-page summary of the differences as summary.md."
    },
    {
      "type": "document",
      "name": "vendor-a.pdf",
      "source": {
        "type": "url",
        "url": "https://example.com/vendor-a.pdf"
      }
    }
  ]
}
Nothing is sent: the button shows the 202 Accepted this request returns.
Fig. The request. Field names are the API's; the values are an example.

Watch it work, then read what comes back

GET /o/{org}/sessions/{session}/events
event: tool_useread · vendor-a.pdf (14 pages)
event: thinkingTermination terms differ by 60 days.
event: tool_usewrite · summary.md
event: messageWrote summary.md.
Fig. The live stream while it works. Event names are the stream's.
GET /o/{org}/sessions/{session}
status
completed
artifacts
[{ name: "summary.md", url: … }]
total_cost_usd
0.19
Fig. The session when it ends. Field names are the API's.

Steps

  1. 01

    Send the request

    input is a string, or text and file blocks: an image, a document or a file you uploaded first.

  2. 02

    Follow it or wait

    Hold the event stream, poll the session, or let your webhook tell you when it ends.

  3. 03

    Download the artifact

    Files the agent writes for you come back as the session's artifacts; download one by its id.

In the API and the docs