> ## Documentation Index
> Fetch the complete documentation index at: https://slide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Build your first AI agent in 5 minutes

In this quickstart, you'll build an AI agent that can search the web and analyze images. Let's dive in!

<Note>
  **Requirements:** Python 3.11 or higher
</Note>

<Steps>
  <Step title="Install Slide">
    <Tabs>
      <Tab title="uv (Recommended)">
        ```bash theme={null}
        # Install uv if you haven't already
        curl -LsSf https://astral.sh/uv/install.sh | sh

        # Create a new project
        uv init my-agent
        cd my-agent

        # Install Slide
        uv add slide-tyler slide-lye slide-narrator
        ```
      </Tab>

      <Tab title="pip">
        ```bash theme={null}
        # Create a virtual environment (Python 3.11+)
        python3 -m venv venv
        source venv/bin/activate  # On Windows: venv\Scripts\activate

        # Install Slide
        pip install slide-tyler slide-lye slide-narrator
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Set Up Your API Key">
    Your agent needs an API key to use the LLM. Choose your provider:

    <Tabs>
      <Tab title="OpenAI">
        Create your API key from [platform.openai.com](https://platform.openai.com/api-keys) then add it to your environment:

        ```bash theme={null}
        export OPENAI_API_KEY="sk-..."
        ```
      </Tab>

      <Tab title="Anthropic">
        Create your API key from [console.anthropic.com](https://console.anthropic.com/) then add it to your environment:

        ```bash theme={null}
        export ANTHROPIC_API_KEY="sk-ant-..."
        ```
      </Tab>

      <Tab title="Other Providers">
        Slide supports 100+ providers via LiteLLM. See the [full list](https://docs.litellm.ai/docs/providers).

        Example for Google:

        ```bash theme={null}
        export GOOGLE_API_KEY="..."
        ```
      </Tab>
    </Tabs>

    <Tip>
      For production, use a `.env` file. If you choose this approach:

      1. Install python-dotenv: `uv add python-dotenv` or `pip install python-dotenv`
      2. Create a `.env` file with your API keys
      3. Uncomment the dotenv import lines in the code example below
    </Tip>
  </Step>

  <Step title="Create Your Agent">
    Create a file called `agent.py`:

    ```python theme={null}
    # Optional: If you're using a .env file for API keys, uncomment these lines
    # from dotenv import load_dotenv
    # load_dotenv()

    import asyncio
    from tyler import Agent, Thread, Message, EventType
    from lye import WEB_TOOLS, IMAGE_TOOLS, FILES_TOOLS

    # Optional: Uncomment these lines if you want observiabiltiy with W&B Weave
    # import weave
    # weave.init("wandb-designers/my-agent")

    async def main():
        # Create your agent
        agent = Agent(
            name="research-assistant",
            model_name="gpt-4o",  # Use the model for your API key provider
            purpose="To help with research and analysis tasks",
            tools=[
                *WEB_TOOLS,      # Can search and fetch web content
                *IMAGE_TOOLS    # Can analyze and describe images
            ]
        )

        # Create a conversation thread
        thread = Thread()
        thread.add_message(Message(
            role="user",
            content="Search for information about the Mars Perseverance rover and create a summary"
        ))
        
        # Watch your agent work in real-time
        print("🤖 Agent is working...\n")
        async for event in agent.stream(thread):
            # Print content as it's generated
            if event.type == EventType.LLM_STREAM_CHUNK:
                print(event.data['content_chunk'], end="", flush=True)
            # Show tool usage
            elif event.type == EventType.TOOL_SELECTED:
                print(f"\n\n🔧 Using {event.data['tool_name']}...", flush=True)

    if __name__ == "__main__":
        asyncio.run(main())
    ```
  </Step>

  <Step title="Run Your Agent">
    <Tabs>
      <Tab title="uv">
        ```bash theme={null}
        uv run agent.py
        ```
      </Tab>

      <Tab title="python">
        ```bash theme={null}
        python agent.py
        ```
      </Tab>
    </Tabs>

    Your agent will search for information about the Mars rover and create a summary. That's it! 🎉
  </Step>
</Steps>

## What's Next?

Now that you have a working agent, explore these guides to add more capabilities:

<CardGroup cols={2}>
  <Card title="Your First Agent" icon="sparkles" href="/guides/your-first-agent">
    Detailed walkthrough with persistence and interactive sessions
  </Card>

  <Card title="Tyler CLI" icon="terminal" href="/apps/tyler-cli">
    Chat with agents instantly using the interactive CLI
  </Card>

  <Card title="Conversation Persistence" icon="database" href="/guides/conversation-persistence">
    Make your agent maintain conversation history
  </Card>

  <Card title="Streaming Responses" icon="stream" href="/guides/streaming-responses">
    See responses as they're generated in real-time
  </Card>

  <Card title="Testing Agents" icon="vial" href="/guides/testing-agents">
    Write tests to ensure your agent behaves correctly
  </Card>
</CardGroup>

## Deploy Your Agent

<CardGroup cols={2}>
  <Card title="Deploy to Slack" icon="slack" href="/apps/slack-agent">
    Turn your agent into a Slack agent
  </Card>

  <Card title="Adding Tools" icon="wrench" href="/guides/adding-tools">
    Add built-in and custom tools to agents
  </Card>
</CardGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Python Version Errors">
    If you see errors like "No solution found when resolving dependencies" or "requires Python>=3.11":

    **For uv users:**

    ```bash theme={null}
    # If you initialized with an older Python version, edit your pyproject.toml:
    # requires-python = ">=3.11"

    # Then recreate your virtual environment:
    rm -rf .venv
    uv sync
    ```

    **For pip users:** We recommend switching to uv for better dependency management:

    ```bash theme={null}
    # Install uv
    curl -LsSf https://astral.sh/uv/install.sh | sh

    # Recreate your project with uv
    uv init my-agent
    cd my-agent
    uv add slide-tyler slide-lye slide-narrator
    ```
  </Accordion>

  <Accordion title="API Key Errors">
    Make sure to set your OpenAI API key:

    ```bash theme={null}
    export OPENAI_API_KEY="sk-..."
    ```

    Or use a different model provider:

    ```python theme={null}
    agent = Agent(
        model_name="claude-3-opus-20240229",  # Anthropic
        # or
        model_name="gemini-pro",  # Google
        # or
        model_name="o3",  # OpenAI O-series
    )
    ```

    <Note>
      Tyler automatically handles model-specific parameter restrictions. For example, O-series models
      only support `temperature=1`, but Tyler will automatically drop incompatible parameters, so you
      can use the same agent configuration across all models.
    </Note>
  </Accordion>

  <Accordion title="Import Errors">
    Make sure you've installed all packages:

    ```bash theme={null}
    uv add slide-tyler slide-lye slide-narrator
    ```
  </Accordion>

  <Accordion title="Async Errors">
    Remember to use `asyncio.run()` or run in an async context:

    ```python theme={null}
    import asyncio

    async def main():
        # Your agent code here
        pass

    asyncio.run(main())
    ```
  </Accordion>
</AccordionGroup>
