This directory contains example scripts and interactive tools for exploring the Llama Stack Client Python SDK.
interactive_agent_cli.py - An interactive command-line tool for exploring agent turn/step events with server-side tools.
- π File Search Integration: Automatically sets up a vector store with sample knowledge base
- π Event Streaming: See real-time turn/step events as the agent processes your queries
- π― Server-Side Tools: Demonstrates file_search and other server-side tool execution
- π¬ Interactive REPL: Chat-style interface for easy exploration
-
Start a Llama Stack server with OpenAI provider:
cd ~/local/llama-stack source ../stack-venv/bin/activate export OPENAI_API_KEY=<your-key> llama stack run ci-tests --port 8321
-
Install the client (from repository root):
cd /Users/ashwin/local/new-stainless/llama-stack-client-python uv sync
Basic usage (uses defaults: openai/gpt-4o, localhost:8321):
cd examples
uv run python interactive_agent_cli.pyWith custom options:
uv run python interactive_agent_cli.py --model openai/gpt-4o-mini --base-url http://localhost:8321ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β π€ Interactive Agent Explorer π β
β β
β Explore agent turn/step events with server-side tools β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π§ Configuration:
Model: openai/gpt-4o
Server: http://localhost:8321
π Connecting to server...
β Connected
π Setting up knowledge base...
Indexing documents....... β
Vector store ID: vs_abc123
π€ Creating agent with tools...
β Agent ready
π¬ Type your questions (or 'quit' to exit, 'help' for suggestions)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π§ You: What is Project Phoenix?
π€ Assistant:
ββββ Turn turn_abc123 started ββββ
β β
β π§ Inference Step 0 started β
β π Tool Execution Step 1 β
β Tool: knowledge_search β
β Status: server_side β
β π§ Inference Step 2 β
β β Response: Project Phoenix... β
β β
ββββ Turn completed βββββββββββββββ
Project Phoenix is a next-generation distributed systems platform launched in 2024...
The tool uses AgentEventLogger to display:
- Turn lifecycle: TurnStarted β TurnCompleted
- Inference steps: When the model is thinking/generating text
- Tool execution steps: When server-side tools (like file_search) are running
- Step metadata: Whether tools are server-side or client-side
- Real-time streaming: Text appears as it's generated
Type help in the interactive session to see suggested questions, or try:
- "What is Project Phoenix?"
- "Who is the lead architect?"
- "What ports does the system use?"
- "How long do JWT tokens last?"
- "Where is the production environment deployed?"
Type quit, exit, q, or press Ctrl+C to exit.