Next Gen UI Llama Stack Integration
This module is part of the Next Gen UI Agent project.
Support for Llama Stack framework.
Provides
NextGenUILlamaStackAgent- takes all tool messages from provided conversation turn steps (Llama Stack Agent API), and process data from them into UI components.- Tool name is used as
InputData.typefor the UI Agent, so distinct configurations can be applied based on it, like input data transformations, defined UI components (dynamic ot Hand Build) etc. - Two event types can be emitted during the processing:
successwith output from the UI Agent processing. Payload is array ofUIBlock.errorwith error from the UI Agent processing. Payload isException.
- Depending on the agent's
execution_mode, processing is performed as:stream: Process individual data in parallel, yield each result as an independent event immediatelly as processing completes/fails. So overall number of produced events is the same as number of data pieces. Eachsuccessevent contains exactly oneUIBlockin the payload array. (default)batch: Process individual data in parallel, yield all results as one event containing results for all the data, or oneerrorevent if processing of any data fails.
- Tool name is used as
LlamaStackAgentInferenceandLlamaStackAsyncAgentInferenceto use LLM hosted in Llama Stack server (Llama Stack Chat Completion API)
Installation
pip install -U next_gen_ui_llama_stack
Example
Integrate Next Gen UI with your assistent
Let's have your ReAct Agent e.g. Movies agent like this:
from llama_stack_client.lib.agents.react.agent import ReActAgent
client = LlamaStackClient(
base_url=f"http://{LLAMA_STACK_HOST}:{LLAMA_STACK_PORT}",
)
INFERENCE_MODEL = "meta-llama/Llama-3.2-3B-Instruct"
movies_agent = ReActAgent(
client=client,
model=INFERENCE_MODEL,
client_tools=[
movies,
],
json_response_format=True,
)
session_id = movies_agent.create_session("test-session")
# Send a query to your agent
response = movies_agent.create_turn(
messages=[{"role": "user", "content": user_input}],
session_id=session_id,
stream=False,
)
Use NextGenUILlamaStackAgent class and just pass llama stack client and model name and
pass steps from your movies agent to Next Gen UI Agent.
from next_gen_ui_llama_stack import NextGenUILlamaStackAgent
# Pass steps to Next Gen UI Agent for processing. Events with results are emitted.
ngui_agent = NextGenUILlamaStackAgent(client, INFERENCE_MODEL)
result = await ngui_agent.create_turn(user_input, steps=response.steps)
Links
Metadata
Release files for next-gen-ui-llama-stack 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| next_gen_ui_llama_stack-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / next_gen_ui_llama_stack-0.4.0-py3-none-any.whl
| Download URL | next_gen_ui_llama_stack-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0aca5eeec7458e54daf7704fe1b8c7962d5f7131d09e7681d9ad60e5fe3257dc
|
|
BLAKE2b-256 checksum How to use checksums |
f8b01e3b0e66686ccfa072a71a2b04e7b56ee2c352acd26fd51d975e8819adfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for next-gen-ui-llama-stack 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.