Agents Quickstart
Build and run your first autonomous agent in under 5 minutes.
Prerequisites
- FlyMy.AI account with API key -- get one at app.flymy.ai/profile
- Python 3.9+ or Node.js 18+
Install the SDK
- Python
- JavaScript
pip install flymyai
npm install flymyai-js-client
Scenario A: Agent for Yourself
Create an agent, run it, get results -- all from your code.
1. Create Tools and an Agent
- Python
- JavaScript
from flymyai import AgentClient
client = AgentClient(api_key="fly-***")
# Register tools first — each returns a Tool object with an integer .id
web_search = client.tools.create(mcp_tool="tavily")
browser = client.tools.create(mcp_tool="browser")
agent = client.agents.create(
name="Web Researcher",
goal="Search the web for the latest breakthroughs in quantum computing and return a concise summary with sources.",
tools=[web_search.id, browser.id]
)
print(f"Agent created: {agent.id}")
import { AgentClient } from "flymyai-js-client";
const client = new AgentClient({ apiKey: "fly-***" });
// Register tools first — each returns a Tool object with an integer .id
const webSearch = await client.tools.create({ mcpTool: "tavily" });
const browser = await client.tools.create({ mcpTool: "browser" });
const agent = await client.agents.create({
name: "Web Researcher",
goal: "Search the web for the latest breakthroughs in quantum computing and return a concise summary with sources.",
tools: [webSearch.id, browser.id]
});
console.log(`Agent created: ${agent.id}`);
2. Start a Run
- Python
- JavaScript
run = client.runs.create(agent_id=agent.id)
print(f"Run started: {run.id} (status: {run.status})")
const run = await client.runs.create({ agentId: agent.id });
console.log(`Run started: ${run.id} (status: ${run.status})`);
3. Stream Events and Get Results
- Python
- JavaScript
# Watch execution in real-time
for event in client.runs.stream_events(run.id):
print(f"[{event.type}] {event.message}")
# [declared_functions] Registered 3 tool functions
# [tool_called] tavily_search("quantum computing breakthroughs")
# [tool_called] browser_navigate("https://example.com/quantum-2025")
# [task_cancelled] — only if the run is cancelled
# Get final output
result = client.runs.wait(run.id)
print(result.output)
for await (const event of client.runs.streamEvents(run.id)) {
console.log(`[${event.type}] ${event.message}`);
}
const result = await client.runs.get(run.id);
console.log(result.output);
Run Statuses
A run progresses through these statuses:
| Status | Meaning |
|---|---|
pending | Run created, waiting to start |
running | Agent is actively executing |
completed | Finished successfully |
failed | Encountered an error |
cancelled | Cancelled by the user |
Using Handlebars Templating
You can use {{ variable }} syntax in the goal to make agents reusable. Variables are rendered from the agent's context at runtime.
agent = client.agents.create(
name="Lead Profiler",
goal="""Create a sales lead profile for {{ name }} at {{ company }}.
{{#if job_title}}Their job title is {{ job_title }}.{{/if}}
{{#if website}}Review the company website: {{ website }}.{{/if}}
Return bullet points covering:
- Background and responsibilities
- Recent company initiatives
- Potential buying triggers
- Recommended outreach angle""",
tools=[web_search.id, browser.id]
)
Scenario B: Agent for Marketplace
Build an agent that others can run on app.flymy.ai. You define the inputs -- FlyMy.AI generates the form. Marketplace features -- including input_schema, output_schema, visibility, pricing, and client.agents.publish() -- are not yet available in the API. The examples below describe planned functionality.
1. Create with Input Schema and Templating
The input schema will define what data users provide. Handlebars templating ({{ variable }}) will inject those values into the agent's goal at runtime.
- Python
- JavaScript
# Planned API — not yet available
from flymyai import AgentClient
client = AgentClient(api_key="fly-***")
web_search = client.tools.create(mcp_tool="tavily")
browser = client.tools.create(mcp_tool="browser")
agent = client.agents.create(
name="Sales Lead Profiler",
goal="""Create a concise sales lead profile for {{ name }} at {{ company }}.
{{#if job_title}}Their job title is {{ job_title }}.{{/if}}
{{#if website}}Review the company website ({{ website }}) for recent news.{{/if}}
{{#if linkedin_url}}Check their LinkedIn profile: {{ linkedin_url }}.{{/if}}
Return bullet points covering:
- Background and responsibilities
- Recent company initiatives
- Potential buying triggers
- Recommended outreach angle""",
tools=[web_search.id, browser.id],
# Planned — JSON Schema defining form fields on app.flymy.ai
input_schema={
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Person's full name"
},
"company": {
"type": "string",
"description": "Company they work at"
},
"job_title": {
"type": "string",
"description": "Job title (optional)"
},
"website": {
"type": "string",
"description": "Company website URL (optional)"
},
"linkedin_url": {
"type": "string",
"description": "Public LinkedIn profile URL (optional)"
}
},
"required": ["name", "company"]
},
# Planned — structured output for programmatic consumers
output_schema={
"type": "object",
"properties": {
"background": {"type": "string"},
"company_initiatives": {"type": "array", "items": {"type": "string"}},
"buying_triggers": {"type": "array", "items": {"type": "string"}},
"outreach_angle": {"type": "string"}
}
},
# Planned — marketplace settings
visibility="public",
pricing={"per_run": 0.25}
)
// Planned API — not yet available
import { AgentClient } from "flymyai-js-client";
const client = new AgentClient({ apiKey: "fly-***" });
const webSearch = await client.tools.create({ mcpTool: "tavily" });
const browser = await client.tools.create({ mcpTool: "browser" });
const agent = await client.agents.create({
name: "Sales Lead Profiler",
goal: `Create a concise sales lead profile for {{ name }} at {{ company }}.
{{#if job_title}}Their job title is {{ job_title }}.{{/if}}
{{#if website}}Review the company website ({{ website }}) for recent news.{{/if}}
{{#if linkedin_url}}Check their LinkedIn profile: {{ linkedin_url }}.{{/if}}
Return bullet points covering background, initiatives, buying triggers, outreach angle.`,
tools: [webSearch.id, browser.id],
// Planned — marketplace settings
inputSchema: {
type: "object",
properties: {
name: { type: "string", description: "Person's full name" },
company: { type: "string", description: "Company they work at" },
job_title: { type: "string", description: "Job title (optional)" },
website: { type: "string", description: "Company website URL (optional)" },
linkedin_url: { type: "string", description: "Public LinkedIn profile URL (optional)" }
},
required: ["name", "company"]
},
outputSchema: {
type: "object",
properties: {
background: { type: "string" },
company_initiatives: { type: "array", items: { type: "string" } },
buying_triggers: { type: "array", items: { type: "string" } },
outreach_angle: { type: "string" }
}
},
visibility: "public",
pricing: { perRun: 0.25 }
});
2. Test Before Publishing
# Planned API — not yet available
test_run = client.runs.create(agent_id=agent.id)
result = client.runs.wait(test_run.id)
print(result.output)
3. Publish to Marketplace
# Planned API — not yet available
client.agents.publish(agent_id=agent.id)
After publishing, your agent will be live at app.flymy.ai/agents/your-username/sales-lead-profiler:
- FlyMy.AI generates an input form from your
input_schema - Required fields are marked, optional fields are collapsible
- Field descriptions become placeholder text/tooltips
- Users click "Run Agent", pay per execution, and see results in the UI
How It Looks for Buyers
When someone visits your agent page on FlyMy.AI:
┌──────────────────────────────────────────────────┐
│ Sales Lead Profiler by @you │
│ │
│ ┌────────────────────────────────────────────┐ │
│ │ Name * [Dana Lee ] │ │
│ │ Company * [Acme Robotics ] │ │
│ │ Job title [VP Engineering ] │ │
│ │ Company website [acmerobotics.com ] │ │
│ │ LinkedIn URL [ ] │ │
│ └────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────┐ │
│ │ > Run Agent $0.25 │ │
│ └─────────────────────┘ │
└──────────────────────────────────────────────────┘
What's Next
- Agents Overview -- architecture and key capabilities
- Tools & MCP -- add tools and external services