Skip to content
Tradebird Docs
Developer guides and referenceIntegrate with Tradebird

Track a run and handle approval requests

Start a run when you want the selected agent to do work. For example, a script can ask it to summarize an installation guide the agent may read. The calling credential must be allowed to invoke that agent.

In an authenticated SDK client, set TRADEBIRD_AGENT_ID to the agent’s UUID. Use one request key for this logical task, save the returned run ID, and use it to read progress. If the response is lost, retry that task with the same key and input.

from uuid import UUID
import os

task = client.agent_runs.create(
    agent_id=UUID(os.environ["TRADEBIRD_AGENT_ID"]),
    arguments={"message": "Summarize our approved installation guide."},
    request_key="installation-summary-1",
)
current = client.agent_runs.get(task.id)

Read the current work and open question before responding. A clarification asks for information. An approval authorizes the exact operation, arguments, and destination shown to the decision maker. Send the response against that work item, then fetch its state again. Waiting, completed, failed, and stopped outcomes need different handling. Preserve uncertain external effects for reconciliation. Recover an interrupted action.

Does the agent need an answer or an approval?

“Which site should we visit?” asks for information. “May I create a visit request for the Aarhus site on Tuesday?” asks someone to authorize a specific action. Show the site, date and destination to that person. Replying with an address answers the first question and leaves the second open.

When your app reconnects, fetch the run by its saved ID before offering either choice again. A buyer may already have supplied the address or a teammate may have declined the action. Show the current question or outcome.