Skip to content

Talk to the Biocompile assistant through the API

Last updated

On this page

The Biocompile API lets a script talk to the same AI research assistant you use in the app. You open a conversation, send a message, and poll the turn until the assistant has answered. Every operation needs the agent:converse scope and works with your permissions.

Biocompile’s AI research assistant is an AI co-scientist that answers questions about your files and the literature, runs analyses as Python and R code in a private sandbox, and proposes changes to your projects as contributions.

Paths start with /api/v1/organizations/{organization_id}. Service accounts cannot hold conversations, because the assistant works as a person.

What the assistant may do for a script

agent:converse is a Sensitive scope. A conversation behaves the same whether it is opened in the app, through the API or over MCP, and the assistant acts as you:

  • The assistant has the tools it has in the app. It reads what you can read, runs code in your sandboxes, writes files, runs analyses, drafts figures and sets up pipelines.
  • It never changes a project directly. Its changes are drafts in the conversation’s workbench until they are contributed, as in the app.
  • The conversation follows the app’s rules for its mode (review or Auto Mode), within your organization’s and your own Auto Mode settings.
  • Spending stays yours. Full auto mode, and approving a paid analysis, need spending:approve because they commit credits.
  • When it needs an approval, the turn stops. You can answer it through the API or a person answers in Biocompile.

Open a conversation

POST .../conversations opens a conversation. Every field is optional:

curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/conversations" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{"title": "Weekly literature scan", "project_slug": "rp_cardio01"}'

project_slug gives the conversation a new workbench bound to one project, where the assistant drafts its changes. workbench_id works in one of your workbenches instead. The answer holds the conversation_id and an app_url that opens the same conversation in Biocompile. The link opens in the conversation’s organization: the app switches to it first if you last worked in another one.

The fields the app’s chat offers are accepted too, both when you open a conversation and when you send a turn:

FieldLike in the appEffect
sandbox_slugThe sandbox pickerA sandbox of yours for the assistant to work in. A turn that names none uses the conversation’s.
attachmentsAttaching filesUp to 20 file identifiers (fil_…, or a revision fil_….N) you can read. On create, the files join the conversation’s workbench.
model_idThe model pickerA model for the conversation. auto lets Biocompile choose.
intelligence_selectionThe intelligence pickerA model family member and thinking category, as an object.

A sandbox or a file you cannot use answers 404, whether it exists or not.

Send a message and poll the answer

POST .../conversations/{conversation_id}/turns sends a message and answers 202 with a turn_id as soon as the turn is accepted:

curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/conversations/$CONVERSATION_ID/turns" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: weekly-scan-2026-w44" \
  -d '{"message": "Summarize the papers published this week on MAPK14 inhibitors in inflammation."}'

GET .../conversations/{conversation_id}/turns/{turn_id} returns the turn’s status and its events. Pass the answer’s next_cursor as after on the next poll to receive only new events. Poll every few seconds, because there is no streaming in version 1.

StatusMeaning
queuedAccepted, and the assistant has not started yet
runningThe assistant is working
requires_actionThe assistant waits for an answer. required_action says to what, and required_action.app_url opens the conversation in Biocompile.
completedThe assistant has answered
blockedYour organization’s credits or usage limit stopped the turn
failedThe turn failed. When error.retryable is true, the model or a provider was briefly unavailable and sending the message again usually works.
cancelledThe turn was stopped in the app, by a newer message, or by revoking the credential

Events carry the text and the names of the tools the assistant used. A tool result that reports an error also carries it, so you can see why the assistant tried again. Its reasoning stays in the app. Resending with the same Idempotency-Key returns the same turn and does not start the assistant again.

Read tool calls and their results

Add include=tool_io when you poll a turn or read a conversation to see what the assistant passed to each tool and what it got back. A call and its result share a call_id.

  • Values that look like secrets, such as tokens, API keys, private keys and signed URL signatures, are replaced with [REDACTED].
  • Each input or output is cut at 4,000 characters, and truncated is then true.
  • Tool names and their arguments follow the assistant’s version. They are not part of the stable API, so do not build on them.

Answer what the assistant asks

A turn with status requires_action names what it waits for in required_action. The type tells you which answer fits:

typeThe assistant asksDecisions
questionA question, with options or free textanswer, decline
plan_approvalTo approve its planapprove, decline
executable_approvalTo run an analysis, with a quote when it is paidapprove, decline
contribution_requestTo contribute drafts from the conversation’s workbenchapprove, decline
project_creationTo create a new research project for your work, showing its name and fieldsapprove, decline
respond_in_appAnything else, such as a request for network accessAnswered in Biocompile only

Answer with POST .../conversations/{conversation_id}/turns/{turn_id}/respond:

curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/conversations/$CONVERSATION_ID/turns/$TURN_ID/respond" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{"action_id": "act_3f1c", "decision": "approve"}'

The body takes the action_id from required_action and a decision. A question also takes text or option_ids, and a decline can carry text to tell the assistant why. Approving a paid analysis needs the quote_id from required_action. The answer is 202, and you keep polling the same turn_id while the assistant continues.

Each decision needs the scopes that required_action.required_scopes names. A missing one is refused with 403 and the code insufficient_scope.

DecisionScopes
Answer a question, approve a plan or a free analysis, decline anythingagent:converse
Approve a paid analysisagent:converse and spending:approve
Approve a contribution requestagent:converse and contributions:write

You approve the quote you were shown and never more. If the quote changed or rose, the answer is refused with 409 and nothing is spent. Approving a contribution request contributes the drafts the assistant named: they merge into the project at once, as your decision.

A checkpoint is answered once, and only the one the latest turn waits at now. Poll the turn instead of resending an answer. Biocompile records the answer with your credential.

Run unattended in full auto mode

Full auto mode opens the conversation in the Auto Mode you can choose for a chat in the app, for a conversation nobody watches. Open the conversation with "full_auto": true. It needs a token with agent:converse and spending:approve, in an organization that allows Auto Mode.

While a conversation is in Auto Mode, Biocompile answers an approval a turn stops at as the app does, following your Auto Mode settings and your organization’s rules:

The assistant asks forAnswered automatically when
Approval of its planPlans are set to automatic in your Auto Mode settings
A free analysis that needs approvalFree tool runs are automatic
A paid analysisPaid tools are automatic, the token that sent the turn holds spending:approve, and the quote is no higher than the one shown

Everything else still stops the turn with requires_action: contributions, new projects, questions to you and any other approval. You can answer those through the API like any other. At most 10 approvals are answered in one turn. Your organization’s spending limits, credit balance and network policy apply to each one.

Note: A person who switches the conversation to review mode in the app pauses full auto mode until they switch it back.

Limitations

Conversations through the API have fixed limits:

What is limitedLimitWhat to do instead
Turns running at once per credential3Wait for a turn to finish, after Retry-After seconds
Turns running at once across your credentials5Wait for a turn to finish
Approvals answered in one full auto turn10A person answers the next one in the app

Conversations you started in the app are not listed and cannot be continued through the API. An app reaches only the conversations it opened, and your personal access tokens only theirs. Reading a conversation returns its newest turns first, skipping turns with nothing to read; the assistant’s text is plain, with references to records written as their ids (rp_ab12cd).

Common questions

Can the assistant change my project without my approval through the API?

No. Its changes stay drafts in the conversation’s workbench until a person contributes them, or approves the assistant’s contribution request with a token holding contributions:write. Your Auto Mode settings decide whether the assistant may contribute without asking.

Does a conversation through the API cost more than in the app?

No. The assistant’s work and the analyses it runs are charged exactly as in the app. The API calls themselves are free.

What stops a conversation that runs in full auto mode?

Revoking the token stops it within seconds. A person can also switch the conversation to review mode in the app, which pauses full auto mode.

Controller: Biocompile, Inc.

Your first project starts here.

Free to start, with credits included.

We use this address to prefill your signup. A founder may email you once to help you get started. No newsletter. Privacy Policy

Already have an account? Sign in