packages/docs/examples/overview.mdx
elizaOS comes with a comprehensive collection of examples demonstrating real-world usage patterns. Every example is available in multiple languages with identical functionality.
| Example | TypeScript | Python | Rust | Description |
|---|---|---|---|---|
| CLI Chat | ✅ | ✅ | ✅ | Interactive terminal chat |
| REST API | ✅ 3 frameworks | ✅ 2 frameworks | ✅ 3 frameworks | HTTP endpoints |
| Browser | ✅ React/HTML | — | ✅ WASM | Client-side agents |
| Serverless | ✅ | ✅ | ✅ | AWS/GCP/Vercel/Cloudflare |
| Game | ✅ | ✅ | ✅ | AI dungeon adventure |
All examples are located in the examples/ directory of the elizaOS repository.
bun install
bun run examples/chat/typescript/chat.ts
</Tab>
<Tab title="Python">
```bash
# Clone the repository
git clone https://github.com/elizaos/eliza.git
cd eliza
# Set up Python environment
python -m venv .venv
source .venv/bin/activate
# Install elizaOS packages
pip install -e packages/typescript/python
pip install -e plugins/plugin-openai/python
# Run any Python example
python examples/chat/python/chat.py
cd examples/chat/rust/chat cargo run
</Tab>
</Tabs>
---
## Environment Setup
Most examples require an OpenAI API key:
```bash
export OPENAI_API_KEY="your-api-key-here"
Or create a .env file in the repository root:
OPENAI_API_KEY=your-api-key-here
| Variable | Default | Description |
|---|---|---|
OPENAI_API_KEY | (required) | OpenAI API key |
OPENAI_BASE_URL | https://api.openai.com/v1 | API base URL |
OPENAI_SMALL_MODEL | gpt-5-mini | Model for TEXT_SMALL |
OPENAI_LARGE_MODEL | gpt-5 | Model for TEXT_LARGE |
LOG_LEVEL | info | Set to fatal to suppress logs |
PGLITE_DATA_DIR | memory:// | PGLite storage (TypeScript only) |
All examples use identical APIs across languages:
<Tabs> <Tab title="TypeScript"> ```typescript import { AgentRuntime } from '@elizaos/core'; import { openaiPlugin } from '@elizaos/plugin-openai';const runtime = new AgentRuntime({ character: { name: 'Eliza', bio: 'A helpful AI.' }, plugins: [openaiPlugin], });
await runtime.initialize();
</Tab>
<Tab title="Python">
```python
from elizaos import AgentRuntime, Character
from elizaos_plugin_openai import get_openai_plugin
runtime = AgentRuntime(
character=Character(name="Eliza", bio="A helpful AI."),
plugins=[get_openai_plugin()],
)
await runtime.initialize()
let character = parse_character(r#"{"name": "Eliza", "bio": "A helpful AI."}"#)?; let runtime = AgentRuntime::new(RuntimeOptions { character: Some(character), plugins: vec![create_openai_plugin()?], ..Default::default() }).await?;
runtime.initialize().await?;
</Tab>
</Tabs>
---
## Contributing Examples
We welcome new examples! When contributing:
1. **Implement in all languages** where possible
2. **Follow the existing structure** in `examples/`
3. **Include a README.md** with setup instructions
4. **Test thoroughly** before submitting
See [Contributing to Core](/guides/contribute-to-core) for the full contribution guide.