llama-stack/llama_stack/apis
Dinesh Yeduguru a5c57cd381
agents to use tools api (#673)
# What does this PR do?

PR #639 introduced the notion of Tools API and ability to invoke tools
through API just as any resource. This PR changes the Agents to start
using the Tools API to invoke tools. Major changes include:
1) Ability to specify tool groups with AgentConfig
2) Agent gets the corresponding tool definitions for the specified tools
and pass along to the model
3) Attachements are now named as Documents and their behavior is mostly
unchanged from user perspective
4) You can specify args that can be injected to a tool call through
Agent config. This is especially useful in case of memory tool, where
you want the tool to operate on a specific memory bank.
5) You can also register tool groups with args, which lets the agent
inject these as well into the tool call.
6) All tests have been migrated to use new tools API and fixtures
including client SDK tests
7) Telemetry just works with tools API because of our trace protocol
decorator


## Test Plan
```
pytest -s -v -k fireworks llama_stack/providers/tests/agents/test_agents.py  \
   --safety-shield=meta-llama/Llama-Guard-3-8B \
   --inference-model=meta-llama/Llama-3.1-8B-Instruct

pytest -s -v -k together  llama_stack/providers/tests/tools/test_tools.py \
   --safety-shield=meta-llama/Llama-Guard-3-8B \
   --inference-model=meta-llama/Llama-3.1-8B-Instruct

LLAMA_STACK_CONFIG="/Users/dineshyv/.llama/distributions/llamastack-together/together-run.yaml" pytest -v tests/client-sdk/agents/test_agents.py
```
run.yaml:
https://gist.github.com/dineshyv/0365845ad325e1c2cab755788ccc5994

Notebook:
https://colab.research.google.com/drive/1ck7hXQxRl6UvT-ijNRZ-gMZxH1G3cN2d?usp=sharing
2025-01-08 19:01:00 -08:00
..
agents agents to use tools api (#673) 2025-01-08 19:01:00 -08:00
batch_inference [remove import *] clean up import *'s (#689) 2024-12-27 15:45:44 -08:00
common [bugfix] fix broken vision inference, change serialization for bytes (#693) 2024-12-30 13:57:41 -08:00
datasetio [remove import *] clean up import *'s (#689) 2024-12-27 15:45:44 -08:00
datasets Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
eval Import from the right path (#708) 2025-01-02 13:15:31 -08:00
eval_tasks Add version to REST API url (#478) 2024-11-18 22:44:14 -08:00
inference [remove import *] clean up import *'s (#689) 2024-12-27 15:45:44 -08:00
inspect add --version to llama stack CLI & /version endpoint (#732) 2025-01-08 16:30:06 -08:00
memory Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
memory_banks [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
models [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
post_training [Post training] make validation steps configurable (#715) 2025-01-03 08:43:24 -08:00
safety Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
scoring [rag evals] refactor & add ability to eval retrieval + generation in agentic eval pipeline (#664) 2025-01-02 11:21:33 -08:00
scoring_functions [/scoring] add ability to define aggregation functions for scoring functions & refactors (#597) 2024-12-11 10:03:42 -08:00
shields [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
synthetic_data_generation [remove import *] clean up import *'s (#689) 2024-12-27 15:45:44 -08:00
telemetry Update Telemetry API so OpenAPI generation can work (#640) 2024-12-16 13:00:14 -08:00
tools agents to use tools api (#673) 2025-01-08 19:01:00 -08:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
resource.py Tools API with brave and MCP providers (#639) 2024-12-19 21:25:17 -08:00
version.py Fix the pyopenapi generator avoid potential circular imports 2024-11-18 23:37:52 -08:00