Quickstart
- Reads your source file (or every
.pyfile in a directory). - Sends it to Maitai for translation.
- Creates the agents, attaches their tools as capabilities, and wires sub-agent handoffs.
- Prints a summary including the agent IDs you can open in the Portal.
Single file vs. directory
You can pointagents import at either a single .py file or a directory:
- Single file — best for small agents that live in one module. The entire file is shipped as the source.
- Directory — best for real projects (CrewAI crews, LangGraph subgraphs, custom agent packages). Every
.pyfile in the directory tree is concatenated and shipped as one project, with file separators preserved so the translator knows which code came from which file.
What gets imported
Maitai’s translator looks for any unit of code that combines (1) a system prompt or instruction string conditioning an LLM with (2) an LLM call. Tools and handoffs are optional. That means:- Framework agents (
Agent(name=..., instructions=..., tools=[...])and similar) are recognized directly. - Hand-written loops that build a messages array with a system prompt and call
client.chat.completions.create(...)are also recognized. - Tools / functions that the agent invokes become API Actions or LLM Actions depending on what they do.
- Handoffs between agents — whether explicit (
handoff()), task-pipeline (CrewAI), or implicit (one agent invoking another as a tool) — are translated into sub-agent links.
Source recognized as: <framework>. When it doesn’t recognize anything, it still imports based on the code’s structure — the translator errs on the side of importing rather than silently skipping.
Flags
| Flag | Effect |
|---|---|
--application-name "..." | Target application by name. Required unless --application-id is set. |
--application-id <id> | Target an existing application by ID. |
--create-application | Create the application if it doesn’t exist (paired with --application-name). |
--update | If an agent with the same name already exists, update it in place instead of failing. |
--prune | With --update, also remove actions and handoffs that exist in Maitai but are absent from the source. |
--dry-run | Translate only — print the manifest, don’t create anything. |
--print-manifest | Print the translated manifest alongside the apply summary. |
--diff | Show what would change against the current Maitai state before applying. |
--diff-only | Like --diff, but stop before applying. |
--static | Fall back to local introspection of an OpenAI Agents SDK module (legacy path; does not use Mojo). |
How long does it take?
The import runs asynchronously: when you press enter, the CLI submits a translation job and polls its status until completion. A typical single-file agent finishes in 20-60 seconds; large multi-file projects can take 1-3 minutes. The CLI shows a live status indicator (Queued… → Translating source… → Applying manifest…) so you can see what’s happening.
If the job fails (e.g. the translator couldn’t find any agents in the source), the CLI surfaces a clear error message describing what went wrong.
After import
Each imported agent shows up under your target application in the Portal. From there you can:- Edit prompts and capabilities like any other Maitai agent.
- Publish a version and pin requests to it from your SDK calls.
- Wire additional sub-agents or supplied actions that aren’t in the original source.
- Configure routing and execution mode per agent.
agents import with --update is the easiest way to keep imported agents in sync with code changes; add --prune to also delete capabilities/handoffs that were removed from the source.
Examples
The Maitai repo includes a small fixture suite covering different frameworks and project layouts. Each is suitable as a starting template:examples/agent_import/raw_openai_loop.py— hand-written agent on the raw OpenAI SDKexamples/agent_import/crewai_marketing_crew/— multi-file CrewAI project (agents, tools, tasks, crew)examples/agent_import/langgraph_support_pipeline/— LangGraph with subgraphs in nested directoriesexamples/agent_import/pydantic_ai_support_bot.py— Pydantic AI with typedAgent[Deps, Output]examples/agent_import/custom_devops_assistant/— no framework, hand-written base class across multiple files
Next
- Inspect and edit your imported agents: Create Agent
- Call them from your application: Agent Call
- Add Maitai-native capabilities: LLM Action · API Action