Skip to main content
Task-focused patterns on top of the core loop. All snippets assume BIOMNI_API_KEY is set and use https://api.phylo.bio/api/v1.

Run a batch of analyses

Start many tasks, then collect results as each finishes. Because tasks run asynchronously, kick them all off first and poll afterwards.
Keep your concurrency reasonable and add backoff. If you hit a 429, slow down — see Errors & rate limits.

Handle long-running tasks

Agent tasks can run for minutes. Don’t block a single request on completion — poll with a bounded interval and a timeout:
For interactive or streaming output, use the streaming endpoint instead of polling — see the API reference.

Continue a task

Send another message to the same task with its task_id to ask a follow-up. The agent keeps the task’s context.

Cancel a running task

Stop the agent while it’s still working: