Repository navigation
Examples Cookbook
weego edited this page Nov 15, 2026
·
2 revisions
The v1.0.0 repository includes runnable examples under example/. The versioned offline walkthrough covers examples 13–17: RAG, dynamic DAG, durable tasks, Jobs and history, and signed Providers. The Codex guide has a separate authenticated CLI example.
Install the package locally:
pip install -e .Set provider credentials:
export OPENAI_API_KEY="your_api_key"
export OPENAI_BASE_URL="https://api.openai.com/v1"Some examples still show inline placeholder values such as your_api_key or http://your_base_url/v1. Replace them before running.
| File | Scenario | Extra dependencies | Command |
|---|---|---|---|
example/01.single_agent.py |
Minimal agent call | none | python example/01.single_agent.py |
example/02.tools_agent.py |
Python function tool | none | python example/02.tools_agent.py |
example/03.memory_mem0.py |
Mem0 memory adapter | mem0ai |
python example/03.memory_mem0.py |
example/04.multi_agent.py |
LightSwarm multi-agent routing | none | python example/04.multi_agent.py |
example/05.self_learning.py |
Memory-backed self-learning | mem0ai |
python example/05.self_learning.py |
example/06.chat_with_history.py |
OpenAI-format history messages | none | python example/06.chat_with_history.py |
example/07.use_mcp.py |
MCP tool registration | MCP server config | python example/07.use_mcp.py |
example/08.browser_use.py |
Browser automation as a tool |
browser-use, langchain-openai
|
python example/08.browser_use.py |
example/09.create_tools.py |
Generate tool code | model access | python example/09.create_tools.py |
- Run the minimal agent example.
- Run a simple tool example.
- Enable
result_format="object"andtrace=True. - Test memory, MCP, or browser automation one at a time.
- Add production guardrails only after the basic path is stable.
- Minimal agent: validates credentials and model routing.
- Tools: validates provider function-calling behavior.
- Memory: requires stable
user_idvalues and a working memory backend. - Multi-agent: works best when agent names and roles are specific.
- Chat history: expects OpenAI chat message format.
- MCP: requires at least one enabled server in
mcp/lightagent_mcp_settings.json. - browser-use: should be used when direct APIs are unavailable.
- Tool generator: produces draft code that must be reviewed before production use.
LightAgent Wiki - see the repository, releases, and issues.
- Installation and Your First Agent
- Tools and Integrations
- Memory, Sessions, and RAG
- Workflows and Multiple Agents
- Agent Backends and Codex
- Durable Execution, Jobs, and Subagents
- Safety, Observability, and Evaluation
- Usage, Cost Estimates, and Budgets
- Deployment, Migration, and Verification
- 安装与第一个 Agent
- 工具和集成
- 记忆、会话与 RAG
- 工作流与多 Agent
- 执行后端与 Codex
- 持久执行、Jobs 与 Subagents
- 安全、观测与评测
- 用量统计、费用估算与预算
- 部署、升级与验收
- Quick Start
- Core Concepts
- API Reference
- Examples Cookbook
- Migration Guide
- Tools
- Tool Generator
- Memory
- MCP
- Skills
- LightFlow
- Tree of Thought
- Self-Learning
- Multi-Agent
- Tracing and Debugging
- Langfuse Observability
- Model Providers
- browser-use Integration
- Testing and CI
- Deployment Guide
- Architecture
- Security
- Known Limitations
- FAQ
- FAQ 中文
- Roadmap
- Release Process
- Contributing