Skip to main content

Agents Quickstart

Build and run your first autonomous agent in under 5 minutes.

Prerequisites

Install the SDK

pip install flymyai

Scenario A: Agent for Yourself

Create an agent, run it, get results -- all from your code.

1. Create Tools and an Agent

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}")

2. Start a Run

run = client.runs.create(agent_id=agent.id)

print(f"Run started: {run.id} (status: {run.status})")

3. Stream Events and Get Results

# 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)

Run Statuses

A run progresses through these statuses:

StatusMeaning
pendingRun created, waiting to start
runningAgent is actively executing
completedFinished successfully
failedEncountered an error
cancelledCancelled 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]
)

Planned Feature — Coming Soon

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.

# 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}
)

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