πŸ€– Agentic AI

AI Agents

Autonomous AI that can browse the web, write code, manage files, and complete complex multi-step tasks.

Task
"Find the top 3 trending AI papers this week and summarize them"
🧠
Thinking
I'll search for AI papers on arXiv and Hugging Face...
🌐
Using web_search
Searching "top AI papers this week site:arxiv.org"
πŸ“„
Using read_url
Reading paper abstracts from 3 results...
βœ“
Complete
Here are the top 3 trending AI papers with summaries...

The Agent Loop

Agents work by iterating through a think-act-observe cycle until the task is complete.

🧠
Think
β†’
⚑
Act
β†’
πŸ‘οΈ
Observe
↩

Built-in Tools

🌐

Web Search

Search the internet and browse web pages for information.

web_search
πŸ’»

Code Interpreter

Write and execute Python code in a sandboxed environment.

code_interpreter
πŸ“

File Operations

Read, write, and manage files. Create documents and reports.

file_search
πŸ–₯️

Computer Use

Control a virtual desktopβ€”click, type, take screenshots.

computer
πŸ”§

Custom Functions

Define your own tools for the agent to use.

function
πŸ“Š

Data Analysis

Analyze CSVs, create charts, perform calculations.

code_interpreter

Quick Start

Python - Simple Agent
from mythicdot import MythicDot

client = MythicDot()

# Create an agent with tools
response = client.responses.create(
    model="mythic-4",
    input="What's the weather in Tokyo and convert it to Fahrenheit?",
    tools=[
        {"type": "web_search"},
        {"type": "code_interpreter"}
    ]
)

# Agent automatically:
# 1. Searches for Tokyo weather
# 2. Runs Python to convert Β°C to Β°F
# 3. Returns the final answer

print(response.output_text)

Agent Patterns

πŸ”„ Single Agent

One agent with multiple tools. Good for focused tasks like research, coding, or data analysis.

πŸ”€ Routing

A dispatcher agent routes tasks to specialized agents (coder, researcher, writer).

⛓️ Chain

Agents pass results to each other in sequence. Good for pipelines.

πŸ‘₯ Collaboration

Multiple agents work together, reviewing and improving each other's work.

Custom Tools

Python - Custom Function Tool
# Define your custom tool
tools = [{
    "type": "function",
    "name": "send_email",
    "description": "Send an email to a recipient",
    "parameters": {
        "type": "object",
        "properties": {
            "to": {"type": "string", "description": "Email address"},
            "subject": {"type": "string"},
            "body": {"type": "string"}
        },
        "required": ["to", "subject", "body"]
    }
}]

response = client.responses.create(
    model="mythic-4",
    input="Email john@example.com about the meeting tomorrow",
    tools=tools
)

# Handle the function call
for item in response.output:
    if item.type == "function_call":
        result = send_email(**json.loads(item.arguments))
        # Provide result back to agent...

Best Practices

πŸ’‘ Building Reliable Agents

  • Clear instructions: Be specific about what the agent should and shouldn't do
  • Limit iterations: Set max_turns to prevent infinite loops
  • Validate outputs: Check tool outputs before proceeding
  • Use guardrails: Define boundaries for agent actions
  • Monitor costs: Long agent runs can use many tokens

⚠️ Safety Considerations

Agents can take real actions. Use sandboxed environments for testing. Always require human approval for sensitive operations like sending emails, making purchases, or modifying data.