Skip to content

Conversation

@franciscojavierarceo
Copy link
Collaborator

@franciscojavierarceo franciscojavierarceo commented Aug 19, 2025

What does this PR do?

  • Introduces the Agent Session creation for the Playground and allows users to set tools
    • note tools are actually not usable yet and this is marked explicitly
    • this also caches sessions locally for faster loading on the UI and deletes them appropriately
    • allows users to easily create new sessions as well
  • Moved Model Configuration settings and "System Message" / Prompt to the left component
  • Added new logo and favicon
  • Added new typing animation when LLM is generating

Create New Session

Screenshot 2025-08-21 at 4 18 08 PM

List of Sessions

Screenshot 2025-08-21 at 4 18 56 PM

Test Plan

Unit tests added

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 19, 2025
@franciscojavierarceo franciscojavierarceo changed the title Session manager feat(UI): Adding a session manager Aug 19, 2025
name: string;
messages: Message[];
selectedModel: string;
selectedVectorDb: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forthcoming

@franciscojavierarceo franciscojavierarceo force-pushed the session-manager branch 2 times, most recently from 502615d to 83aa78f Compare August 19, 2025 20:29
@ashwinb
Copy link
Contributor

ashwinb commented Aug 19, 2025

I think this is the best practical solution given we don't support APIs for this on the BE

our agents API offers sessions right? to me this was the reason why we had them. could you explain why that doesn't or won't work?

@franciscojavierarceo
Copy link
Collaborator Author

I was uncertain about the state of the agents API given some discussions during the office hours, but if we intend on maintaining agents API I'll move it there.

@franciscojavierarceo franciscojavierarceo marked this pull request as draft August 20, 2025 04:49
Signed-off-by: Francisco Javier Arceo <[email protected]>

chore: Enable keyword search for Milvus inline (llamastack#3073)

With milvus-io/milvus-lite#294 - Milvus Lite
supports keyword search using BM25. While introducing keyword search we
had explicitly disabled it for inline milvus. This PR removes the need
for the check, and enables `inline::milvus` for tests.

<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[issue-number] -->

Run llama stack with `inline::milvus` enabled:

```
pytest tests/integration/vector_io/test_openai_vector_stores.py::test_openai_vector_store_search_modes --stack-config=http://localhost:8321 --embedding-model=all-MiniLM-L6-v2 -v
```

```
INFO     2025-08-07 17:06:20,932 tests.integration.conftest:64 tests: Setting DISABLE_CODE_SANDBOX=1 for macOS
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.12.11, pytest-7.4.4, pluggy-1.5.0 -- /Users/vnarsing/miniconda3/envs/stack-client/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.12.11', 'Platform': 'macOS-14.7.6-arm64-arm-64bit', 'Packages': {'pytest': '7.4.4', 'pluggy': '1.5.0'}, 'Plugins': {'asyncio': '0.23.8', 'cov': '6.0.0', 'timeout': '2.2.0', 'socket': '0.7.0', 'html': '3.1.1', 'langsmith': '0.3.39', 'anyio': '4.8.0', 'metadata': '3.0.0'}}
rootdir: /Users/vnarsing/go/src/github/meta-llama/llama-stack
configfile: pyproject.toml
plugins: asyncio-0.23.8, cov-6.0.0, timeout-2.2.0, socket-0.7.0, html-3.1.1, langsmith-0.3.39, anyio-4.8.0, metadata-3.0.0
asyncio: mode=Mode.AUTO
collected 3 items

tests/integration/vector_io/test_openai_vector_stores.py::test_openai_vector_store_search_modes[None-None-all-MiniLM-L6-v2-None-384-vector] PASSED                                                   [ 33%]
tests/integration/vector_io/test_openai_vector_stores.py::test_openai_vector_store_search_modes[None-None-all-MiniLM-L6-v2-None-384-keyword] PASSED                                                  [ 66%]
tests/integration/vector_io/test_openai_vector_stores.py::test_openai_vector_store_search_modes[None-None-all-MiniLM-L6-v2-None-384-hybrid] PASSED                                                   [100%]

============================================================================================ 3 passed in 4.75s =============================================================================================
```

Signed-off-by: Varsha Prasad Narsing <[email protected]>
Co-authored-by: Francisco Arceo <[email protected]>

chore: Fixup main pre commit (llamastack#3204)

build: Bump version to 0.2.18

chore: Faster npm pre-commit (llamastack#3206)

Adds npm to pre-commit.yml installation and caches ui
Removes node installation during pre-commit.

<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[issue-number] -->

<!-- Describe the tests you ran to verify your changes with result
summaries. *Provide clear instructions so the plan can be easily
re-executed.* -->

Signed-off-by: Francisco Javier Arceo <[email protected]>

chiecking in for tonight, wip moving to agents api

Signed-off-by: Francisco Javier Arceo <[email protected]>

remove log

Signed-off-by: Francisco Javier Arceo <[email protected]>

updated

Signed-off-by: Francisco Javier Arceo <[email protected]>

fix: disable ui-prettier & ui-eslint (llamastack#3207)

chore(pre-commit): add pre-commit hook to enforce llama_stack logger usage (llamastack#3061)

This PR adds a step in pre-commit to enforce using `llama_stack` logger.

Currently, various parts of the code base uses different loggers. As a
custom `llama_stack` logger exist and used in the codebase, it is better
to standardize its utilization.

Signed-off-by: Mustafa Elbehery <[email protected]>
Co-authored-by: Matthew Farrellee <[email protected]>

fix: fix ```openai_embeddings``` for asymmetric embedding NIMs (llamastack#3205)

NVIDIA asymmetric embedding models (e.g.,
`nvidia/llama-3.2-nv-embedqa-1b-v2`) require an `input_type` parameter
not present in the standard OpenAI embeddings API. This PR adds the
`input_type="query"` as default and updates the documentation to suggest
using the `embedding` API for passage embeddings.

<!-- If resolving an issue, uncomment and update the line below -->
Resolves llamastack#2892

```
pytest -s -v tests/integration/inference/test_openai_embeddings.py   --stack-config="inference=nvidia"   --embedding-model="nvidia/llama-3.2-nv-embedqa-1b-v2"   --env NVIDIA_API_KEY={nvidia_api_key}   --env NVIDIA_BASE_URL="https://integrate.api.nvidia.com"
```

cleaning up

Signed-off-by: Francisco Javier Arceo <[email protected]>

updating session manager to cache messages locally

Signed-off-by: Francisco Javier Arceo <[email protected]>

fix linter

Signed-off-by: Francisco Javier Arceo <[email protected]>

more cleanup

Signed-off-by: Francisco Javier Arceo <[email protected]>
});
};

const response = await client.agents.turn.create(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now using agents api

}

console.log("📡 Fetching agent config from API...");
const agentDetails = await client.agents.retrieve(agentId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting agents

const createDefaultSession = useCallback(
async (agentId: string) => {
try {
const response = await client.agents.session.create(agentId, {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating agent sesion

)
) {
try {
await client.agents.delete(agentId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deletes from DB

await client.agents.delete(agentId);

// clear cached data for agent
SessionUtils.clearAgentCache(agentId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deletes from cache.

@franciscojavierarceo franciscojavierarceo marked this pull request as ready for review August 21, 2025 20:18
const fetchToolgroups = async () => {
try {
console.log("Fetching toolgroups...");
const toolgroups = await client.toolgroups.list();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm calling toolgroups as I believe this maps to the preferred field in the AgentConfig.

@ashwinb
Copy link
Contributor

ashwinb commented Aug 21, 2025

I was uncertain about the state of the agents API given some discussions during the office hours, but if we intend on maintaining agents API I'll move it there.

I think we are keeping it for now for exactly this use case. With Responses, you don't need "turns" etc. and each session can be more flexibly arranged but independent sessions still need to be kept somewhere and so it doesn't take care of that from the client's perspective.

@@ -0,0 +1,345 @@
import React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good tests!

// ensures this only happens client side
const safeLocalStorage = {
getItem: (key: string): string | null => {
if (typeof window === "undefined") return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why doesn't this (and other methods) throw when window is undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next.js does server side rendering so there's no window at when the page is compiled, the null ensures nothing breaks during page rendering, once the client renders the page the content is then hyrdated.

return globalThis.crypto.randomUUID();
};

export function SessionManager({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a react component -- the suffix Manager feels wrong to it? it must have some UI state? how will this be used in UI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state is retrieved from the client.agents.list() and cached locally. I had originally called it SessionManager because my first implementation had sessions stored locally and this was the component managing the local storage of those sessions. I still use much of that pattern for faster refreshes. We can definitely rename it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i renamed this to conversations. it's not using the API for now but i'm happy to swap it to those APIs in the future and I think that should mostly be straightforward.

@ashwinb
Copy link
Contributor

ashwinb commented Aug 21, 2025

@franciscojavierarceo see this https://x.com/OpenAIDevs/status/1958660207745409120 -- specifically the Conversations API. { Conversations + Responses } is an alternative to the Agents API and is likely where the ecosystem is likely to shift to. So while we will now likely get rid of Agents API, I think we are still not going to make session state persist on the client. Clients need to be lightweight.

@franciscojavierarceo franciscojavierarceo merged commit d78ac43 into llamastack:main Aug 22, 2025
5 checks passed
@franciscojavierarceo franciscojavierarceo changed the title feat(UI): Adding a session manager feat(UI): Adding Conversation History Aug 22, 2025
franciscojavierarceo added a commit to franciscojavierarceo/llama-stack that referenced this pull request Aug 22, 2025
# What does this PR do?

- Introduces the Agent Session creation for the Playground and allows
users to set tools
- note tools are actually not usable yet and this is marked explicitly
- this also caches sessions locally for faster loading on the UI and
deletes them appropriately
   - allows users to easily create new sessions as well
- Moved Model Configuration settings and "System Message" / Prompt to
the left component
- Added new logo and favicon
- Added new typing animation when LLM is generating

### Create New Session
<img width="1916" height="1393" alt="Screenshot 2025-08-21 at 4 18
08 PM"
src="https://github.com/user-attachments/assets/52c70ae3-a33e-4338-8522-8184c692c320"
/>


### List of Sessions
<img width="1920" height="1391" alt="Screenshot 2025-08-21 at 4 18
56 PM"
src="https://github.com/user-attachments/assets/ed78c3c6-08ec-486c-8bad-9b7382c11360"
/>

<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[issue-number] -->

## Test Plan
Unit tests added

---------

Signed-off-by: Francisco Javier Arceo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants