Skip to content

Commit 33809bc

Browse files
GlockPLKonrad Czarnotaakotylajakubduda-dsaids-sebastianchwilczynski
authored
feat: Agents in CLI (#776)
Co-authored-by: Konrad Czarnota <[email protected]> Co-authored-by: GlockPL <[email protected]> Co-authored-by: akotyla <[email protected]> Co-authored-by: jakubduda-dsai <[email protected]> Co-authored-by: ds-sebastianchwilczynski <[email protected]> Co-authored-by: dazy-ds <[email protected]> Co-authored-by: pocucan-ds <[email protected]>
1 parent 41e9b33 commit 33809bc

File tree

6 files changed

+588
-5
lines changed

6 files changed

+588
-5
lines changed

examples/agents/cli_agent.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Simple test agent for CLI testing.
2+
3+
run:
4+
5+
uv run ragbits agents run examples.agents.test_cli_agent:test_agent
6+
7+
"""
8+
9+
from ragbits.agents import Agent
10+
from ragbits.core.llms import LiteLLM
11+
12+
13+
def get_current_weather(location: str) -> str:
14+
"""
15+
Get the current weather in a specific location.
16+
17+
Args:
18+
location: The location to get weather for
19+
20+
Returns:
21+
Weather information for the location
22+
"""
23+
# Mock weather data
24+
weather_data = {
25+
"London": "Rainy, 15°C",
26+
"Paris": "Sunny, 22°C",
27+
"New York": "Cloudy, 18°C",
28+
"Tokyo": "Sunny, 25°C",
29+
}
30+
31+
return weather_data.get(location, f"Weather data not available for {location}")
32+
33+
34+
# Create a simple test agent
35+
llm = LiteLLM(model_name="gpt-3.5-turbo")
36+
37+
test_agent = Agent(
38+
llm=llm,
39+
prompt="You are a helpful assistant that can help with weather information and general questions.",
40+
tools=[get_current_weather],
41+
keep_history=True,
42+
)

packages/ragbits-agents/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CHANGELOG
22

33
## Unreleased
4+
- Add Chat with agents in CLI
45
- Add tool_choice parameter to agent interface (#738)
56
- Add PydanticAI agents support (#755)
67
- Add unique ID to each agent instance for better tracking and identification (#790)

packages/ragbits-agents/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ mcp = [
4545
openai = [
4646
"openai>=1.91.0,<2.0.0",
4747
]
48+
cli = [
49+
"textual>=0.85.2,<1.0.0",
50+
]
4851

4952
[project.urls]
5053
"Homepage" = "https://github.com/deepsense-ai/ragbits"

0 commit comments

Comments
 (0)