pyagentkit 0.1.6__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/PKG-INFO +2 -2
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/README.md +1 -1
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/USAGE.md +15 -15
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/pyproject.toml +1 -1
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/.github/workflows/publish.yml +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/.github/workflows/python-publish.yml +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/.gitignore +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/.python-version +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/LICENSE +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/src/pyagentkit/__init__.py +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/src/pyagentkit/agent.py +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/src/pyagentkit/async_agent.py +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/src/pyagentkit/definitions.py +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/src/pyagentkit/exceptions.py +0 -0
- {pyagentkit-0.1.6 → pyagentkit-1.0.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyagentkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Agent toolkit for Ollama
|
|
5
5
|
Project-URL: Homepage, https://github.com/TarikEren/pyagentkit
|
|
6
6
|
Project-URL: Issues, https://github.com/TarikEren/pyagentkit/issues
|
|
@@ -45,7 +45,7 @@ A Python library for building tool-calling agents on top of locally-hosted LLMs
|
|
|
45
45
|
|
|
46
46
|
- Python 3.12+
|
|
47
47
|
- [Ollama](https://ollama.com) running locally (or at a reachable URL)
|
|
48
|
-
- A model pulled in Ollama
|
|
48
|
+
- A model pulled in Ollama
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
@@ -25,7 +25,7 @@ A Python library for building tool-calling agents on top of locally-hosted LLMs
|
|
|
25
25
|
|
|
26
26
|
- Python 3.12+
|
|
27
27
|
- [Ollama](https://ollama.com) running locally (or at a reachable URL)
|
|
28
|
-
- A model pulled in Ollama
|
|
28
|
+
- A model pulled in Ollama
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
from pyagentkit import Agent
|
|
26
26
|
|
|
27
27
|
agent = Agent(
|
|
28
|
-
llm_name="
|
|
28
|
+
llm_name="<llm_name>", # Must be pulled in Ollama
|
|
29
29
|
system_prompt="You are a helpful assistant.",
|
|
30
30
|
agent_name="my-agent",
|
|
31
31
|
)
|
|
@@ -72,7 +72,7 @@ def divide(a: float, b: float) -> ToolResult:
|
|
|
72
72
|
|
|
73
73
|
```python
|
|
74
74
|
agent = Agent(
|
|
75
|
-
llm_name="
|
|
75
|
+
llm_name="<llm_name>",
|
|
76
76
|
tools=[add_numbers, divide], # registered without approval requirement
|
|
77
77
|
)
|
|
78
78
|
```
|
|
@@ -92,7 +92,7 @@ agent.add_tool(add_numbers, requires_approval=False)
|
|
|
92
92
|
Registered on a single agent instance. Use `add_tool` or pass `tools=` to the constructor.
|
|
93
93
|
|
|
94
94
|
```python
|
|
95
|
-
agent = Agent(llm_name="
|
|
95
|
+
agent = Agent(llm_name="<llm_name>")
|
|
96
96
|
agent.add_tool(my_tool, requires_approval=False)
|
|
97
97
|
```
|
|
98
98
|
|
|
@@ -115,8 +115,8 @@ def get_time() -> ToolResult:
|
|
|
115
115
|
)
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
agent_a = MyAgent(llm_name="
|
|
119
|
-
agent_b = MyAgent(llm_name="
|
|
118
|
+
agent_a = MyAgent(llm_name="<llm_name>")
|
|
119
|
+
agent_b = MyAgent(llm_name="<llm_name>", agent_name="second")
|
|
120
120
|
# Both agents can call get_time
|
|
121
121
|
```
|
|
122
122
|
|
|
@@ -146,7 +146,7 @@ def fetch_user(deps: MyDeps, user_id: str) -> ToolResult:
|
|
|
146
146
|
|
|
147
147
|
deps = MyDeps(prompt="Find user 42", db_url="postgresql://...", api_key="sk-...")
|
|
148
148
|
|
|
149
|
-
agent = Agent(llm_name="
|
|
149
|
+
agent = Agent(llm_name="<llm_name>", tools=[fetch_user])
|
|
150
150
|
response = agent.handle_response("Find user 42", deps=deps)
|
|
151
151
|
```
|
|
152
152
|
|
|
@@ -169,7 +169,7 @@ class SentimentResponse(AgentResponse):
|
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
agent = Agent(
|
|
172
|
-
llm_name="
|
|
172
|
+
llm_name="<llm_name>",
|
|
173
173
|
response_model=SentimentResponse,
|
|
174
174
|
system_prompt="You are a sentiment analysis assistant.",
|
|
175
175
|
)
|
|
@@ -201,7 +201,7 @@ async def get_weather(city: str) -> ToolResult:
|
|
|
201
201
|
|
|
202
202
|
async def main():
|
|
203
203
|
agent = await AsyncAgent.create(
|
|
204
|
-
llm_name="
|
|
204
|
+
llm_name="<llm_name>",
|
|
205
205
|
tools=[get_weather],
|
|
206
206
|
agent_name="weather-agent",
|
|
207
207
|
)
|
|
@@ -246,7 +246,7 @@ def on_response_retry(attempt: int, response_str: str, error: str) -> None:
|
|
|
246
246
|
|
|
247
247
|
|
|
248
248
|
agent = Agent(
|
|
249
|
-
llm_name="
|
|
249
|
+
llm_name="<llm_name>",
|
|
250
250
|
on_tool_call=on_tool_call,
|
|
251
251
|
on_tool_retry=on_tool_retry,
|
|
252
252
|
on_tool_success=on_tool_success,
|
|
@@ -268,14 +268,14 @@ from pyagentkit.definitions import ToolResult, ToolReturnValue
|
|
|
268
268
|
|
|
269
269
|
# Inner specialist agent
|
|
270
270
|
researcher = Agent(
|
|
271
|
-
llm_name="
|
|
271
|
+
llm_name="<llm_name>",
|
|
272
272
|
agent_name="researcher",
|
|
273
273
|
system_prompt="You are a research specialist. Answer factual questions concisely.",
|
|
274
274
|
)
|
|
275
275
|
|
|
276
276
|
# Outer orchestrator agent
|
|
277
277
|
orchestrator = Agent(
|
|
278
|
-
llm_name="
|
|
278
|
+
llm_name="<llm_name>",
|
|
279
279
|
agent_name="orchestrator",
|
|
280
280
|
system_prompt="You are an orchestrator. Delegate research tasks to the researcher agent.",
|
|
281
281
|
tools=[researcher.as_tool(description="Ask the researcher agent a factual question.")],
|
|
@@ -294,7 +294,7 @@ print(response.message)
|
|
|
294
294
|
History is maintained automatically within a session. Each call to `handle_response` appends to the same history, giving the agent memory of prior turns.
|
|
295
295
|
|
|
296
296
|
```python
|
|
297
|
-
agent = Agent(llm_name="
|
|
297
|
+
agent = Agent(llm_name="<llm_name>", agent_name="chat-agent")
|
|
298
298
|
|
|
299
299
|
r1 = agent.handle_response("My name is Alice.")
|
|
300
300
|
r2 = agent.handle_response("What is my name?")
|
|
@@ -306,7 +306,7 @@ print(r2.message) # "Your name is Alice."
|
|
|
306
306
|
Set `max_history` to limit how many non-system messages the agent sees. Older messages are dropped automatically. Orphaned assistant messages (those without a preceding user message after trimming) are also removed.
|
|
307
307
|
|
|
308
308
|
```python
|
|
309
|
-
agent = Agent(llm_name="
|
|
309
|
+
agent = Agent(llm_name="<llm_name>", max_history=20)
|
|
310
310
|
```
|
|
311
311
|
|
|
312
312
|
### Saving and loading history
|
|
@@ -386,7 +386,7 @@ def risky_tool(path: str) -> ToolResult:
|
|
|
386
386
|
|
|
387
387
|
| Parameter | Type | Default | Description |
|
|
388
388
|
|-----------|------|---------|-------------|
|
|
389
|
-
| `llm_name` | `str` | required | Ollama model name (e.g. `"
|
|
389
|
+
| `llm_name` | `str` | required | Ollama model name (e.g. `"devstral:22b"`) |
|
|
390
390
|
| `agent_name` | `str \| None` | `llm_name` | Unique name for this agent instance |
|
|
391
391
|
| `system_prompt` | `str \| None` | `""` | Base system prompt prepended to all requests |
|
|
392
392
|
| `instructions` | `str \| None` | `""` | Text appended to every user prompt |
|
|
@@ -411,7 +411,7 @@ def risky_tool(path: str) -> ToolResult:
|
|
|
411
411
|
### Agent lifecycle
|
|
412
412
|
|
|
413
413
|
```python
|
|
414
|
-
agent = Agent(llm_name="
|
|
414
|
+
agent = Agent(llm_name="<llm_name>", agent_name="my-agent")
|
|
415
415
|
|
|
416
416
|
# Use the agent ...
|
|
417
417
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|