add llama-stack introduciton and simple usage#111
Conversation
WalkthroughAdds a new Llama Stack documentation section and example notebooks: landing, install, overview (intro/features), quickstart, and two public Jupyter notebooks demonstrating client-side and MCP-based agent tools and deployment examples. Changes
Sequence Diagram(s)(omitted — changes are documentation and example notebooks; no runtime control-flow changes requiring diagrams) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying alauda-ai with
|
| Latest commit: |
3f8db45
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3089a048.alauda-ai.pages.dev |
| Branch Preview URL: | https://add-llama-stack.alauda-ai.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
docs/public/llama-stack/llama-stack_quickstart_mcp.ipynb (1)
58-59: Avoid exposing raw exception text in tool output.Returning
f"Error: {e}"can leak internal request/runtime details into model-visible output.🛡️ Suggested error message hardening
- except Exception as e: - return f"Error: {e}" + except Exception: + return "Error: failed to fetch weather data. Please try again later."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/public/llama-stack/llama-stack_quickstart_mcp.ipynb` around lines 58 - 59, The except block currently returns the raw exception string (except Exception as e -> return f"Error: {e}"), which can leak internal details; change it to return a fixed, user-safe error message (e.g., "An internal error occurred") instead, and move the detailed exception information to internal logs/monitoring by calling logger.exception(e) or similar inside the except block so the full stack/exception is recorded but not exposed to model/tool output. Ensure you update the except Exception as e handler that contains the f"Error: {e}" return and add appropriate logging/monitoring calls while returning only the generic message to callers.docs/en/llama_stack/quickstart.mdx (1)
69-72: Consider rewording resource bullets to reduce repetitive starts.Lines 69-72 repeatedly start with “Llama Stack …”. Minor polish, but easier to scan if varied.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/llama_stack/quickstart.mdx` around lines 69 - 72, The four bullets starting with "Llama Stack ..." (the items "Llama Stack Documentation", "Llama Stack Core Concepts", "Llama Stack GitHub Repository", and "Llama Stack Example Apps") are repetitive—rewrite them to vary the lead phrase for easier scanning (e.g., "Documentation:", "Core concepts:", "GitHub repo:", "Example apps:") while preserving the links and the original descriptions; update the lines in quickstart.mdx that contain those exact bullet texts to the new phrasing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/en/llama_stack/install.mdx`:
- Around line 13-17: The CLI example exposes a plaintext password via the
--platform-password flag (violet push), so change the example to avoid inline
credentials: remove the --platform-password=... usage and show a safer approach
such as prompting for the password, reading it from an environment variable
(e.g. PLATFORM_PASSWORD) or from a protected file/secret (e.g.
--platform-password-from-file), and update the example invocation and
explanatory text to demonstrate that pattern instead of embedding secrets in the
command line.
In `@docs/public/llama-stack/llama-stack_quickstart_mcp.ipynb`:
- Around line 42-49: The docstring for get_weather_mcp incorrectly states the
function returns a dictionary; update the :returns: section to reflect that
get_weather_mcp returns a formatted string (or an error string) instead of a
dict—e.g., change the return-type description to "str" and describe the string
contents (formatted weather summary or error message) so the docstring matches
the function's actual behavior.
---
Nitpick comments:
In `@docs/en/llama_stack/quickstart.mdx`:
- Around line 69-72: The four bullets starting with "Llama Stack ..." (the items
"Llama Stack Documentation", "Llama Stack Core Concepts", "Llama Stack GitHub
Repository", and "Llama Stack Example Apps") are repetitive—rewrite them to vary
the lead phrase for easier scanning (e.g., "Documentation:", "Core concepts:",
"GitHub repo:", "Example apps:") while preserving the links and the original
descriptions; update the lines in quickstart.mdx that contain those exact bullet
texts to the new phrasing.
In `@docs/public/llama-stack/llama-stack_quickstart_mcp.ipynb`:
- Around line 58-59: The except block currently returns the raw exception string
(except Exception as e -> return f"Error: {e}"), which can leak internal
details; change it to return a fixed, user-safe error message (e.g., "An
internal error occurred") instead, and move the detailed exception information
to internal logs/monitoring by calling logger.exception(e) or similar inside the
except block so the full stack/exception is recorded but not exposed to
model/tool output. Ensure you update the except Exception as e handler that
contains the f"Error: {e}" return and add appropriate logging/monitoring calls
while returning only the generic message to callers.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
docs/en/llama_stack/index.mdxdocs/en/llama_stack/install.mdxdocs/en/llama_stack/overview/features.mdxdocs/en/llama_stack/overview/index.mdxdocs/en/llama_stack/overview/intro.mdxdocs/en/llama_stack/quickstart.mdxdocs/public/llama-stack/llama-stack_quickstart.ipynbdocs/public/llama-stack/llama-stack_quickstart_mcp.ipynb
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/public/llama-stack/llama-stack_quickstart.ipynb`:
- Around line 87-94: The docstring for get_weather incorrectly states it returns
a formatted string; update the docstring to reflect the actual return type (a
Dict) and describe the dictionary keys and value types (e.g., {"city": str,
"temperature": str or float, "humidity": str or int, "error": Optional[str]} or
similar) so the :returns: section and description match the function signature
and implementation.
- Around line 324-329: The cell currently always starts a new
Thread(target=run_server, daemon=True) which can spawn duplicate servers on
re-runs; change it to first check if a running server_thread exists (e.g., if
'server_thread' in globals() and server_thread.is_alive()) and only create/start
the Thread when no alive server_thread is present, otherwise skip startup and
print that the server is already running; apply this guard around the Thread
creation/start and associated print so the cell becomes idempotent across
notebook re-runs.
- Around line 109-110: The except block that returns {'error': f'Failed to get
weather information: {str(e)}'} should not expose raw exception details; change
it to return a generic client-facing message (e.g., {'error': 'Failed to get
weather information'}) and log the full exception separately using a logger
(call logger.exception or logger.error with the exception) inside the same
except Exception as e: block so the variable e is recorded for debugging but not
returned to the caller.
- Around line 267-289: The chat endpoint currently calls
agent.create_session('fastapi-weather-session') on every request which creates a
new session each time; update the ChatRequest model to accept an optional
session_id, modify the chat(request: ChatRequest) handler to use
request.session_id if present, otherwise call agent.create_session() once to
create a new session_id, pass that session_id into agent.create_turn(...), and
include the (possibly newly created) session_id in the JSON response so clients
can reuse it for conversational continuity.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
docs/en/llama_stack/quickstart.mdx (2)
42-42: Consider adding a note about the Python version currency.The download URL is pinned to a specific version dated January 14, 2026. For better maintainability, consider adding a note indicating this is the current version as of the documentation date, and provide guidance on finding newer versions (e.g., linking to the releases page at https://github.com/astral-sh/python-build-standalone/releases).
📝 Suggested improvement
1. Download the pre-compiled Python installation package: + **Note**: The following URL uses a specific version (January 14, 2026). For the latest version, visit the [Python Build Standalone releases page](https://github.com/astral-sh/python-build-standalone/releases). + ```bash wget -O /tmp/python312.tar.gz https://github.com/astral-sh/python-build-standalone/releases/download/20260114/cpython-3.12.12+20260114-x86_64-unknown-linux-gnu-install_only.tar.gz ```🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/llama_stack/quickstart.mdx` at line 42, Add a short note immediately above or below the wget command that the URL is pinned to a specific Python build (the cpython-3.12.12+20260114 URL) and that it was current as of the documentation date, and include a link to the upstream releases page (https://github.com/astral-sh/python-build-standalone/releases) with guidance to check there for newer versions; update the text around the wget line to explicitly recommend verifying the version before downloading and to replace the URL with a newer release if available.
75-78: Consider varying the sentence structure for better readability.All four bullet points begin with "Llama Stack," which creates a repetitive reading experience. Consider varying the sentence structure for improved flow.
✍️ Example variation
-- [Llama Stack Documentation](https://llamastack.github.io/docs) - The official Llama Stack documentation covering all usage-related topics, API providers, and core concepts. -- [Llama Stack Core Concepts](https://llamastack.github.io/docs/concepts) - Deep dive into Llama Stack architecture, API stability, and resource management. -- [Llama Stack GitHub Repository](https://github.com/llamastack/llama-stack) - Source code, example applications, distribution configurations, and how to add new API providers. -- [Llama Stack Example Apps](https://github.com/llamastack/llama-stack-apps/) - Official examples demonstrating how to use Llama Stack in various scenarios. +- [Official Documentation](https://llamastack.github.io/docs) - Comprehensive Llama Stack documentation covering all usage-related topics, API providers, and core concepts. +- [Core Concepts Guide](https://llamastack.github.io/docs/concepts) - Deep dive into architecture, API stability, and resource management. +- [GitHub Repository](https://github.com/llamastack/llama-stack) - Source code, example applications, distribution configurations, and how to add new API providers. +- [Example Applications](https://github.com/llamastack/llama-stack-apps/) - Official examples demonstrating various usage scenarios.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/en/llama_stack/quickstart.mdx` around lines 75 - 78, The four list entries ("Llama Stack Documentation", "Llama Stack Core Concepts", "Llama Stack GitHub Repository", "Llama Stack Example Apps") are repetitive because each starts with "Llama Stack"; reword each bullet to vary sentence openings and improve flow by moving the subject or action first (e.g., "Official documentation: ...", "Deep dive into core concepts: ...", "Source code and examples on GitHub: ...", "Explore example applications: ..."), keeping the same URLs and concise descriptions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/en/llama_stack/quickstart.mdx`:
- Line 42: Add a short note immediately above or below the wget command that the
URL is pinned to a specific Python build (the cpython-3.12.12+20260114 URL) and
that it was current as of the documentation date, and include a link to the
upstream releases page
(https://github.com/astral-sh/python-build-standalone/releases) with guidance to
check there for newer versions; update the text around the wget line to
explicitly recommend verifying the version before downloading and to replace the
URL with a newer release if available.
- Around line 75-78: The four list entries ("Llama Stack Documentation", "Llama
Stack Core Concepts", "Llama Stack GitHub Repository", "Llama Stack Example
Apps") are repetitive because each starts with "Llama Stack"; reword each bullet
to vary sentence openings and improve flow by moving the subject or action first
(e.g., "Official documentation: ...", "Deep dive into core concepts: ...",
"Source code and examples on GitHub: ...", "Explore example applications: ..."),
keeping the same URLs and concise descriptions.
* add llama-stack introduciton and simple usage * update * update * update
Summary by CodeRabbit