Commands, package names, and image names on this page come from the open-source project that Mibyan Desktop is built on, and can differ from the Mibyan Desktop installer. For the supported Mibyan install and update path, see Install and update.
AIAgent directly and use it programmatically in your own Python scripts, web applications, or automation pipelines. This guide shows you how.
Installation
Clone Mibyan and prepare its source environment through PM. The Bash recipe is:python your_app.py from that activated checkout.
For PowerShell preparation or an independent interpreter, see the
PM developer workflow.
Mibyan does not publish a supported wheel or source distribution for requirements.txt installs.
Basic Usage
The simplest way to use Mibyan is thechat() method — pass a message, get a string back:
chat() handles the full conversation loop internally — tool calls, retries, everything — and returns just the final text response.
Full Conversation Control
For more control over the conversation, userun_conversation() directly. It returns a dictionary with the full response, message history, and metadata:
final_response— The agent’s final text replymessages— The complete message history (system, user, assistant, tool calls)
task_id you pass in is stored on the agent instance for VM isolation but isn’t echoed back in the return dict.)
You can also pass a custom system message that overrides the ephemeral system prompt for that call:
Configuring Tools
Control which toolsets the agent has access to usingenabled_toolsets or disabled_toolsets:
Multi-turn Conversations
Maintain conversation state across multiple turns by passing the message history back in:conversation_history parameter accepts the messages list from a previous result. The agent copies it internally, so your original list is never mutated.
Saving Trajectories
Enable trajectory saving to capture conversations in ShareGPT format — useful for generating training data or debugging:Custom System Prompts
Useephemeral_system_prompt to set a custom system prompt that guides the agent’s behavior but is not saved to trajectory files (keeping your training data clean):
Batch Processing
For running many prompts in parallel, Mibyan includesbatch_runner.py. It manages concurrent AIAgent instances with proper resource isolation:
task_id and isolated environment. If you need custom batch logic, you can build your own using AIAgent directly:

