Skip to main content

Agent MAX SDK

Agent MAX is currently in private beta. Join the waitlist to get early access.
Agent MAX is available through our Python and TypeScript SDKs.

Python SDK

pip install incredible-python

TypeScript SDK

npm install @incredible-ai/sdk

Quick Start

from incredible import AgentMax

# Initialize
agent = AgentMax(api_key="YOUR_API_KEY")

# Use run_with_results() to get structured output back
result = agent.run_with_results(
    goal="Research competitors and summarize findings",
    result_structure={
        "type": "object",
        "properties": {
            "competitors": {"type": "array"},
            "summary": {"type": "string"}
        }
    }
)

print(result.output)  # Guaranteed to match your schema

Methods

agent.run()

Execute a task for side effects only (sending emails, updating databases, etc.). Does not return meaningful output.
# run() is for fire-and-forget tasks with side effects
agent.run(
    goal="Send personalized outreach emails to all at-risk customers",
    files=[open("customers.csv", "rb")],  # Pass file objects
    data={"context": "Q1 2024"},
    tools=[crm_tool, email_tool],
    max_steps=50,
    timeout=300
)

# The task runs. Emails get sent. No structured output returned.
print("Outreach campaign started!")
Parameters:
ParameterTypeRequiredDescription
goalstringWhat you want the agent to accomplish
filesFile[]File objects to process
dataobjectAdditional context data
toolsTool[]Custom tools the agent can use
max_stepsintMaximum steps (default: 100)
timeoutintTimeout in seconds (default: 600)
run() does not return structured output. Use run_with_results() if you need data back.

agent.run_with_results()

Execute a task and get output matching a specific JSON schema. Guaranteed.
# Open files properly
with open("meeting_transcript.txt", "r") as f:
    result = agent.run_with_results(
        goal="Extract all action items from this meeting",
        files=[f],
        result_structure={
            "type": "object",
            "properties": {
                "action_items": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "task": {"type": "string"},
                            "assignee": {"type": "string"},
                            "due_date": {"type": "string"},
                            "priority": {"type": "string", "enum": ["high", "medium", "low"]}
                        },
                        "required": ["task", "assignee"]
                    }
                },
                "summary": {"type": "string"}
            },
            "required": ["action_items", "summary"]
        }
    )

# result.output ALWAYS matches the schema
for item in result.output["action_items"]:
    print(f"- [{item['priority']}] {item['task']}{item['assignee']}")
Parameters:
ParameterTypeRequiredDescription
goalstringWhat you want the agent to accomplish
result_structureobjectJSON Schema the output must match
filesFile[]File objects to process
dataobjectAdditional context data
toolsTool[]Custom tools the agent can use

agent.stream()

Stream results as they’re generated.
for event in agent.stream(
    goal="Write a detailed market analysis"
):
    if event.type == "step":
        print(f"Step {event.step}: {event.action}")
    elif event.type == "progress":
        print(f"Progress: {event.message}")
    elif event.type == "output":
        print(f"Output chunk: {event.content}")
    elif event.type == "done":
        print(f"Complete! Total steps: {event.total_steps}")

Defining Custom Tools

Tools let Agent MAX interact with your systems.
from incredible import Tool

# Define a tool
crm_search = Tool(
    name="search_crm",
    description="Search the CRM for customer information",
    parameters={
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "Search query (company name, email, etc.)"
            },
            "limit": {
                "type": "integer",
                "description": "Max results to return",
                "default": 10
            }
        },
        "required": ["query"]
    },
    # Handler function that executes when tool is called
    handler=lambda params: your_crm_api.search(params["query"], params.get("limit", 10))
)

# Use the tool with run_with_results to get data back
result = agent.run_with_results(
    goal="Find all customers in the healthcare industry",
    tools=[crm_search],
    result_structure={
        "type": "object",
        "properties": {
            "customers": {"type": "array"},
            "total_count": {"type": "integer"}
        }
    }
)

File Handling

Agent MAX automatically handles common file types. Pass proper file objects, not strings.
FormatHandling
PDFOCR + text extraction
CSV/ExcelParsed into structured data
ImagesOCR for text, vision for analysis
AudioTranscription
JSONDirect parsing
TextDirect reading
# Open files as proper file objects
with open("report.pdf", "rb") as pdf, \
     open("data.csv", "r") as csv, \
     open("screenshot.png", "rb") as img:
    
    result = agent.run_with_results(
        goal="Summarize these documents",
        files=[pdf, csv, img],
        result_structure={
            "type": "object",
            "properties": {
                "summary": {"type": "string"}
            }
        }
    )

# Using pathlib
from pathlib import Path

pdf_file = Path("report.pdf").open("rb")
result = agent.run_with_results(
    goal="Extract key findings",
    files=[pdf_file],
    result_structure={"type": "object", "properties": {"findings": {"type": "array"}}}
)
pdf_file.close()

Built-in Tools

Agent MAX comes with these tools pre-configured:
ToolDescription
web_searchSearch the web for information
web_scrapeExtract content from web pages
code_executeRun Python/TypeScript code
file_readRead and parse files
file_writeCreate or modify files
Enable built-in tools:
result = agent.run_with_results(
    goal="Research latest AI news and summarize top 5 stories",
    builtin_tools=["web_search", "web_scrape"],
    result_structure={
        "type": "object",
        "properties": {
            "stories": {"type": "array"},
            "summary": {"type": "string"}
        }
    }
)

Error Handling

from incredible import AgentMax, AgentMaxError, TimeoutError, ValidationError

agent = AgentMax(api_key="YOUR_API_KEY")

try:
    result = agent.run(goal="Complex task")
except TimeoutError:
    print("Task took too long")
except ValidationError as e:
    print(f"Invalid input: {e.message}")
except AgentMaxError as e:
    print(f"Agent error: {e.message}")
    print(f"Partial results: {e.partial_output}")
    print(f"Steps completed: {e.steps_completed}")

Webhooks

Get notified when long-running tasks complete:
result = agent.run(
    goal="Long research task",
    webhook_url="https://your-app.com/webhook",
    webhook_events=["complete", "error", "step"]
)

# Returns immediately with task ID
print(f"Task started: {result.task_id}")
Webhook Payload:
{
  "event": "complete",
  "task_id": "task_abc123",
  "output": "Research findings...",
  "tokens_used": 12450,
  "execution_time": 45.2
}

Rate Limits

PlanConcurrent TasksSteps/minute
Free1100
Pro5500
EnterpriseUnlimitedUnlimited

Next Steps