Slide supports 100+ providers via LiteLLM. See the full list.Example for Google:
Copy
export GOOGLE_API_KEY="..."
For production, use a .env file. If you choose this approach:
Install python-dotenv: uv add python-dotenv or pip install python-dotenv
Create a .env file with your API keys
Uncomment the dotenv import lines in the code example below
3
Create Your Agent
Create a file called agent.py:
Copy
# Optional: If you're using a .env file for API keys, uncomment these lines# from dotenv import load_dotenv# load_dotenv()import asynciofrom tyler import Agent, Thread, Message, EventTypefrom 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())
4
Run Your Agent
uv
python
Copy
uv run agent.py
Copy
python agent.py
Your agent will search for information about the Mars rover and create a summary. That’s it! 🎉
If you see errors like “No solution found when resolving dependencies” or “requires Python>=3.11”:For uv users:
Copy
# If you initialized with an older Python version, edit your pyproject.toml:# requires-python = ">=3.11"# Then recreate your virtual environment:rm -rf .venvuv sync
For pip users: We recommend switching to uv for better dependency management:
Copy
# Install uvcurl -LsSf https://astral.sh/uv/install.sh | sh# Recreate your project with uvuv init my-agentcd my-agentuv add slide-tyler slide-lye slide-narrator
API Key Errors
Make sure to set your OpenAI API key:
Copy
export OPENAI_API_KEY="sk-..."
Or use a different model provider:
Copy
agent = Agent( model_name="claude-3-opus-20240229", # Anthropic # or model_name="gemini-pro", # Google # or model_name="o3", # OpenAI O-series)
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.
Import Errors
Make sure you’ve installed all packages:
Copy
uv add slide-tyler slide-lye slide-narrator
Async Errors
Remember to use asyncio.run() or run in an async context:
Copy
import asyncioasync def main(): # Your agent code here passasyncio.run(main())