agentify-core 0.1.0__tar.gz → 0.1.2__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.
- {agentify_core-0.1.0/agentify_core.egg-info → agentify_core-0.1.2}/PKG-INFO +15 -9
- {agentify_core-0.1.0 → agentify_core-0.1.2}/README.md +12 -6
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/core/agent.py +39 -8
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/core/callbacks.py +10 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/core/config.py +3 -1
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/service.py +35 -23
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/multi_agent/hierarchical.py +0 -4
- agentify_core-0.1.2/agentify/utils/__init__.py +0 -0
- agentify_core-0.1.2/agentify/utils/style.py +9 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2/agentify_core.egg-info}/PKG-INFO +15 -9
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify_core.egg-info/SOURCES.txt +2 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify_core.egg-info/requires.txt +2 -2
- {agentify_core-0.1.0 → agentify_core-0.1.2}/pyproject.toml +3 -3
- {agentify_core-0.1.0 → agentify_core-0.1.2}/requirements.txt +1 -1
- {agentify_core-0.1.0 → agentify_core-0.1.2}/LICENSE +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/MANIFEST.in +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/core/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/core/tool.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/prompts/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/prompts/assistant.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/tools/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/tools/calculator.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/tools/time.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/extensions/tools/weather.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/llm/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/llm/client.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/interfaces.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/policies.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/stores/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/stores/in_memory_store.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/memory/stores/redis_store.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/multi_agent/__init__.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/multi_agent/pipeline.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/multi_agent/team.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify/multi_agent/tool_wrapper.py +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify_core.egg-info/dependency_links.txt +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/agentify_core.egg-info/top_level.txt +0 -0
- {agentify_core-0.1.0 → agentify_core-0.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentify-core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Framework-agnostic AI agent library for building single and multi-agent systems
|
|
5
5
|
Author-email: Fabian M <fabian@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -30,11 +30,11 @@ Requires-Dist: redis>=4.0.0; extra == "redis"
|
|
|
30
30
|
Provides-Extra: tools
|
|
31
31
|
Requires-Dist: requests>=2.25.0; extra == "tools"
|
|
32
32
|
Provides-Extra: ui
|
|
33
|
-
Requires-Dist: gradio
|
|
33
|
+
Requires-Dist: gradio==5.49.1; extra == "ui"
|
|
34
34
|
Provides-Extra: all
|
|
35
35
|
Requires-Dist: redis>=4.0.0; extra == "all"
|
|
36
36
|
Requires-Dist: requests>=2.25.0; extra == "all"
|
|
37
|
-
Requires-Dist: gradio
|
|
37
|
+
Requires-Dist: gradio==5.49.1; extra == "all"
|
|
38
38
|
Provides-Extra: dev
|
|
39
39
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
40
40
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
@@ -66,6 +66,10 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
66
66
|
- **Memory service and isolation**
|
|
67
67
|
Pluggable backends (in-memory, Redis, …) with per-use-case policies (TTL, maximum messages, etc.), plus optional memory isolation so each agent can maintain its own conversation history for scalability and privacy.
|
|
68
68
|
|
|
69
|
+
- **Reasoning Models**
|
|
70
|
+
Configure the model's thinking depth, safely merge `model_kwargs`, automatically store
|
|
71
|
+
"Chain of Thought" in conversation history, and log reasoning steps in real-time for visibility.
|
|
72
|
+
|
|
69
73
|
- **Tools and actions**
|
|
70
74
|
Type-annotated tool interface, straightforward registration of custom tools.
|
|
71
75
|
|
|
@@ -79,12 +83,12 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
79
83
|
## Installation
|
|
80
84
|
|
|
81
85
|
```bash
|
|
82
|
-
pip install agentify
|
|
86
|
+
pip install agentify-core
|
|
83
87
|
```
|
|
84
88
|
|
|
85
89
|
For optional features:
|
|
86
90
|
```bash
|
|
87
|
-
pip install agentify[all] # Installs all optional dependencies
|
|
91
|
+
pip install agentify-core[all] # Installs all optional dependencies
|
|
88
92
|
```
|
|
89
93
|
|
|
90
94
|
## Quick Start
|
|
@@ -94,16 +98,18 @@ from agentify import BaseAgent, AgentConfig, MemoryService, MemoryAddress
|
|
|
94
98
|
from agentify.memory.stores import InMemoryStore
|
|
95
99
|
|
|
96
100
|
# 1. Create memory service
|
|
97
|
-
memory = MemoryService(store=InMemoryStore())
|
|
101
|
+
memory = MemoryService(store=InMemoryStore(), log_enabled=True, max_log_length=100)
|
|
98
102
|
addr = MemoryAddress(conversation_id="session_1")
|
|
99
103
|
|
|
100
104
|
# 2. Create an Agent
|
|
101
105
|
agent = BaseAgent(
|
|
102
106
|
config=AgentConfig(
|
|
103
|
-
name="
|
|
104
|
-
system_prompt="You are a helpful
|
|
107
|
+
name="ReasoningAgent",
|
|
108
|
+
system_prompt="You are a helpful assistant.",
|
|
105
109
|
provider="openai",
|
|
106
|
-
model_name="gpt-
|
|
110
|
+
model_name="gpt-5",
|
|
111
|
+
reasoning_effort="high", # optional param:"low", "medium", "high"
|
|
112
|
+
model_kwargs={"max_completion_tokens": 5000} # Pass model-specific params
|
|
107
113
|
),
|
|
108
114
|
memory=memory,
|
|
109
115
|
memory_address=addr
|
|
@@ -19,6 +19,10 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
19
19
|
- **Memory service and isolation**
|
|
20
20
|
Pluggable backends (in-memory, Redis, …) with per-use-case policies (TTL, maximum messages, etc.), plus optional memory isolation so each agent can maintain its own conversation history for scalability and privacy.
|
|
21
21
|
|
|
22
|
+
- **Reasoning Models**
|
|
23
|
+
Configure the model's thinking depth, safely merge `model_kwargs`, automatically store
|
|
24
|
+
"Chain of Thought" in conversation history, and log reasoning steps in real-time for visibility.
|
|
25
|
+
|
|
22
26
|
- **Tools and actions**
|
|
23
27
|
Type-annotated tool interface, straightforward registration of custom tools.
|
|
24
28
|
|
|
@@ -32,12 +36,12 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
32
36
|
## Installation
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
pip install agentify
|
|
39
|
+
pip install agentify-core
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
For optional features:
|
|
39
43
|
```bash
|
|
40
|
-
pip install agentify[all] # Installs all optional dependencies
|
|
44
|
+
pip install agentify-core[all] # Installs all optional dependencies
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
## Quick Start
|
|
@@ -47,16 +51,18 @@ from agentify import BaseAgent, AgentConfig, MemoryService, MemoryAddress
|
|
|
47
51
|
from agentify.memory.stores import InMemoryStore
|
|
48
52
|
|
|
49
53
|
# 1. Create memory service
|
|
50
|
-
memory = MemoryService(store=InMemoryStore())
|
|
54
|
+
memory = MemoryService(store=InMemoryStore(), log_enabled=True, max_log_length=100)
|
|
51
55
|
addr = MemoryAddress(conversation_id="session_1")
|
|
52
56
|
|
|
53
57
|
# 2. Create an Agent
|
|
54
58
|
agent = BaseAgent(
|
|
55
59
|
config=AgentConfig(
|
|
56
|
-
name="
|
|
57
|
-
system_prompt="You are a helpful
|
|
60
|
+
name="ReasoningAgent",
|
|
61
|
+
system_prompt="You are a helpful assistant.",
|
|
58
62
|
provider="openai",
|
|
59
|
-
model_name="gpt-
|
|
63
|
+
model_name="gpt-5",
|
|
64
|
+
reasoning_effort="high", # optional param:"low", "medium", "high"
|
|
65
|
+
model_kwargs={"max_completion_tokens": 5000} # Pass model-specific params
|
|
60
66
|
),
|
|
61
67
|
memory=memory,
|
|
62
68
|
memory_address=addr
|
|
@@ -209,6 +209,14 @@ class BaseAgent:
|
|
|
209
209
|
"temperature": self.config.temperature,
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
if self.config.reasoning_effort:
|
|
213
|
+
common_params["reasoning_effort"] = self.config.reasoning_effort
|
|
214
|
+
|
|
215
|
+
if self.config.model_kwargs:
|
|
216
|
+
for k, v in self.config.model_kwargs.items():
|
|
217
|
+
if k not in common_params:
|
|
218
|
+
common_params[k] = v
|
|
219
|
+
|
|
212
220
|
# Only add tools if they exist
|
|
213
221
|
tools_payload = self.tool_defs
|
|
214
222
|
if tools_payload:
|
|
@@ -347,11 +355,12 @@ class BaseAgent:
|
|
|
347
355
|
) -> Generator[str, None, List[Dict[str, Any]]]:
|
|
348
356
|
"""
|
|
349
357
|
Process streaming response, yielding content and collecting tool calls.
|
|
350
|
-
Returns
|
|
358
|
+
Returns a tuple of (assembled tool calls, full reasoning content).
|
|
351
359
|
"""
|
|
352
360
|
tool_call_assembler: Dict[int, Dict[str, Any]] = {}
|
|
353
361
|
|
|
354
362
|
full_content = []
|
|
363
|
+
full_reasoning = []
|
|
355
364
|
|
|
356
365
|
for chunk in response_stream:
|
|
357
366
|
if not chunk.choices:
|
|
@@ -364,6 +373,12 @@ class BaseAgent:
|
|
|
364
373
|
full_content.append(delta.content)
|
|
365
374
|
yield delta.content
|
|
366
375
|
|
|
376
|
+
# Handle reasoning content if present (e.g. DeepSeek-R1)
|
|
377
|
+
if hasattr(delta, "reasoning_content") and delta.reasoning_content:
|
|
378
|
+
for cb in self.callbacks:
|
|
379
|
+
cb.on_reasoning_step(delta.reasoning_content)
|
|
380
|
+
full_reasoning.append(delta.reasoning_content)
|
|
381
|
+
|
|
367
382
|
if delta.tool_calls:
|
|
368
383
|
for tc_delta in delta.tool_calls:
|
|
369
384
|
idx = tc_delta.index
|
|
@@ -401,13 +416,20 @@ class BaseAgent:
|
|
|
401
416
|
if call_data.get("function", {}).get("name"):
|
|
402
417
|
assembled_tool_calls.append(call_data)
|
|
403
418
|
|
|
404
|
-
return assembled_tool_calls
|
|
419
|
+
return assembled_tool_calls, "".join(full_reasoning)
|
|
405
420
|
|
|
406
421
|
def _process_sync_response(
|
|
407
422
|
self, msg_object: Any
|
|
408
|
-
) -> tuple[Optional[str], List[Dict[str, Any]]]:
|
|
409
|
-
"""Process synchronous response, returning content and
|
|
423
|
+
) -> tuple[Optional[str], List[Dict[str, Any]], Optional[str]]:
|
|
424
|
+
"""Process synchronous response, returning content, tool calls, and reasoning content."""
|
|
410
425
|
content = getattr(msg_object, "content", None)
|
|
426
|
+
|
|
427
|
+
# Handle reasoning content if present
|
|
428
|
+
reasoning_content = getattr(msg_object, "reasoning_content", None)
|
|
429
|
+
if reasoning_content:
|
|
430
|
+
for cb in self.callbacks:
|
|
431
|
+
cb.on_reasoning_step(reasoning_content)
|
|
432
|
+
|
|
411
433
|
tool_calls = []
|
|
412
434
|
|
|
413
435
|
if getattr(msg_object, "tool_calls", None):
|
|
@@ -427,7 +449,7 @@ class BaseAgent:
|
|
|
427
449
|
}
|
|
428
450
|
)
|
|
429
451
|
|
|
430
|
-
return content, tool_calls
|
|
452
|
+
return content, tool_calls, reasoning_content
|
|
431
453
|
|
|
432
454
|
def _expand_tool_calls(
|
|
433
455
|
self, tool_calls: List[Dict[str, Any]]
|
|
@@ -509,6 +531,7 @@ class BaseAgent:
|
|
|
509
531
|
|
|
510
532
|
current_turn_content_parts: List[str] = []
|
|
511
533
|
assembled_tool_calls: List[Dict[str, Any]] = []
|
|
534
|
+
full_reasoning_content: Optional[str] = None
|
|
512
535
|
|
|
513
536
|
if self.config.stream:
|
|
514
537
|
gen = self._process_stream_response(response_or_stream) # type: ignore
|
|
@@ -518,9 +541,9 @@ class BaseAgent:
|
|
|
518
541
|
yield content_chunk
|
|
519
542
|
current_turn_content_parts.append(content_chunk)
|
|
520
543
|
except StopIteration as e:
|
|
521
|
-
assembled_tool_calls = e.value
|
|
544
|
+
assembled_tool_calls, full_reasoning_content = e.value
|
|
522
545
|
else:
|
|
523
|
-
content, assembled_tool_calls = self._process_sync_response(
|
|
546
|
+
content, assembled_tool_calls, full_reasoning_content = self._process_sync_response(
|
|
524
547
|
response_or_stream
|
|
525
548
|
)
|
|
526
549
|
if content:
|
|
@@ -533,7 +556,12 @@ class BaseAgent:
|
|
|
533
556
|
|
|
534
557
|
# If no tool calls, we are done
|
|
535
558
|
if not assembled_tool_calls:
|
|
536
|
-
|
|
559
|
+
# Add reasoning to metadata if present
|
|
560
|
+
msg_kwargs = {}
|
|
561
|
+
if full_reasoning_content:
|
|
562
|
+
msg_kwargs["metadata"] = {"reasoning_content": full_reasoning_content}
|
|
563
|
+
|
|
564
|
+
self.add(role="assistant", content=full_turn_content, addr=addr, **msg_kwargs)
|
|
537
565
|
for cb in self.callbacks:
|
|
538
566
|
cb.on_agent_finish(self.config.name, full_turn_content)
|
|
539
567
|
break
|
|
@@ -543,6 +571,9 @@ class BaseAgent:
|
|
|
543
571
|
if full_turn_content:
|
|
544
572
|
assistant_msg["content"] = full_turn_content
|
|
545
573
|
assistant_msg["tool_calls"] = assembled_tool_calls
|
|
574
|
+
if full_reasoning_content:
|
|
575
|
+
assistant_msg["metadata"] = {"reasoning_content": full_reasoning_content}
|
|
576
|
+
|
|
546
577
|
self.add(addr=addr, **assistant_msg)
|
|
547
578
|
|
|
548
579
|
# Execute tools
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Optional, Protocol
|
|
2
2
|
import logging
|
|
3
|
+
from agentify.utils.style import Colors
|
|
3
4
|
|
|
4
5
|
logger = logging.getLogger(__name__)
|
|
5
6
|
|
|
@@ -35,6 +36,10 @@ class AgentCallbackHandler(Protocol):
|
|
|
35
36
|
"""Called when the LLM finishes generating a response."""
|
|
36
37
|
...
|
|
37
38
|
|
|
39
|
+
def on_reasoning_step(self, content: str) -> None:
|
|
40
|
+
"""Called when the LLM generates a reasoning step."""
|
|
41
|
+
...
|
|
42
|
+
|
|
38
43
|
def on_error(self, error: Exception, context: str) -> None:
|
|
39
44
|
"""Called when an error occurs."""
|
|
40
45
|
...
|
|
@@ -69,5 +74,10 @@ class LoggingCallbackHandler(AgentCallbackHandler):
|
|
|
69
74
|
def on_llm_end(self, response: Any) -> None:
|
|
70
75
|
self.logger.debug("LLM finished.")
|
|
71
76
|
|
|
77
|
+
def on_reasoning_step(self, content: str) -> None:
|
|
78
|
+
self.logger.info(
|
|
79
|
+
f"{Colors.GRAY}[Reasoning]{Colors.RESET} {Colors.GRAY}{content}{Colors.RESET}"
|
|
80
|
+
)
|
|
81
|
+
|
|
72
82
|
def on_error(self, error: Exception, context: str) -> None:
|
|
73
83
|
self.logger.error(f"Error in {context}: {error}", exc_info=True)
|
|
@@ -17,11 +17,13 @@ class AgentConfig:
|
|
|
17
17
|
system_prompt: str
|
|
18
18
|
provider: str
|
|
19
19
|
model_name: str
|
|
20
|
-
temperature: float =
|
|
20
|
+
temperature: float = 1
|
|
21
21
|
timeout: int = 60
|
|
22
22
|
stream: bool = False
|
|
23
23
|
max_retries: int = 3
|
|
24
24
|
max_tool_iter: int = 5
|
|
25
|
+
reasoning_effort: Optional[str] = None
|
|
26
|
+
model_kwargs: Optional[Dict[str, Any]] = None
|
|
25
27
|
client_config_override: Optional[Dict[str, Any]] = None
|
|
26
28
|
callbacks: list = None
|
|
27
29
|
|
|
@@ -4,23 +4,9 @@ import os
|
|
|
4
4
|
from typing import Any, Dict, List, Optional
|
|
5
5
|
from .interfaces import ConversationStore, MemoryAddress, Message
|
|
6
6
|
from .policies import MemoryPolicy
|
|
7
|
+
from agentify.utils.style import Colors
|
|
7
8
|
|
|
8
|
-
# Flag to enable/disable memory logging (can be controlled via env var)
|
|
9
|
-
ENABLE_MEMORY_LOGS = os.getenv("AGENTIFY_MEMORY_LOGS", "true").lower()
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
# ANSI color codes for terminal output
|
|
13
|
-
class Colors:
|
|
14
|
-
RESET = "\033[0m"
|
|
15
|
-
BLUE = "\033[94m" # system
|
|
16
|
-
GREEN = "\033[92m" # user
|
|
17
|
-
YELLOW = "\033[93m" # assistant
|
|
18
|
-
CYAN = "\033[96m" # tool
|
|
19
|
-
MAGENTA = "\033[95m" # tool calls
|
|
20
|
-
GRAY = "\033[90m" # metadata
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# Configure logger with handler for terminal output
|
|
24
10
|
logger = logging.getLogger(__name__)
|
|
25
11
|
if not logger.handlers:
|
|
26
12
|
handler = logging.StreamHandler()
|
|
@@ -37,10 +23,16 @@ class MemoryService:
|
|
|
37
23
|
"""
|
|
38
24
|
|
|
39
25
|
def __init__(
|
|
40
|
-
self,
|
|
26
|
+
self,
|
|
27
|
+
store: ConversationStore,
|
|
28
|
+
policy: Optional[MemoryPolicy] = None,
|
|
29
|
+
log_enabled: bool = True,
|
|
30
|
+
max_log_length: Optional[int] = None,
|
|
41
31
|
) -> None:
|
|
42
32
|
self.store = store
|
|
43
33
|
self.policy = policy or MemoryPolicy(store)
|
|
34
|
+
self.log_enabled = log_enabled
|
|
35
|
+
self.max_log_length = max_log_length # max length preview of the log
|
|
44
36
|
|
|
45
37
|
def _normalize_message(self, message: Dict[str, Any]) -> Message:
|
|
46
38
|
"""Accept OpenAI-shaped dicts; move unknown keys (e.g., 'tool_calls') into metadata.
|
|
@@ -67,7 +59,7 @@ class MemoryService:
|
|
|
67
59
|
self.policy.on_append(addr, msg)
|
|
68
60
|
|
|
69
61
|
# Log message with color coding by role (only if enabled)
|
|
70
|
-
if
|
|
62
|
+
if self.log_enabled:
|
|
71
63
|
role_colors = {
|
|
72
64
|
"system": Colors.BLUE,
|
|
73
65
|
"user": Colors.GREEN,
|
|
@@ -76,11 +68,19 @@ class MemoryService:
|
|
|
76
68
|
}
|
|
77
69
|
|
|
78
70
|
color = role_colors.get(msg.role, Colors.RESET)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
|
|
72
|
+
# Extract agent_id if available to show WHO is speaking
|
|
73
|
+
agent_id = addr.agent_id if addr and addr.agent_id else "unknown"
|
|
74
|
+
agent_tag = f"[{agent_id}]" if agent_id else ""
|
|
75
|
+
|
|
76
|
+
if self.max_log_length is None:
|
|
77
|
+
content_preview = msg.content
|
|
78
|
+
else:
|
|
79
|
+
content_preview = (
|
|
80
|
+
(msg.content[: self.max_log_length] + "...")
|
|
81
|
+
if msg.content and len(msg.content) > self.max_log_length
|
|
82
|
+
else msg.content
|
|
83
|
+
)
|
|
84
84
|
|
|
85
85
|
tool_info = ""
|
|
86
86
|
if msg.metadata and "tool_calls" in msg.metadata:
|
|
@@ -93,9 +93,21 @@ class MemoryService:
|
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
logger.info(
|
|
96
|
-
f"{color}[{msg.role}]{Colors.RESET} {content_preview}{tool_info}"
|
|
96
|
+
f"{Colors.GRAY}{agent_tag}{Colors.RESET}{color}[{msg.role}]{Colors.RESET} {content_preview}{tool_info}"
|
|
97
97
|
)
|
|
98
98
|
|
|
99
|
+
# Log reasoning if present in metadata
|
|
100
|
+
if msg.metadata and "reasoning_content" in msg.metadata:
|
|
101
|
+
reasoning = msg.metadata["reasoning_content"]
|
|
102
|
+
if self.max_log_length is not None and len(reasoning) > self.max_log_length:
|
|
103
|
+
reasoning_preview = reasoning[: self.max_log_length] + "..."
|
|
104
|
+
else:
|
|
105
|
+
reasoning_preview = reasoning
|
|
106
|
+
|
|
107
|
+
logger.info(
|
|
108
|
+
f"{Colors.GRAY}{agent_tag}{Colors.RESET}{Colors.GRAY}[Reasoning]{Colors.RESET} {Colors.GRAY}{reasoning_preview}{Colors.RESET}"
|
|
109
|
+
)
|
|
110
|
+
|
|
99
111
|
def reset_history(
|
|
100
112
|
self, addr: MemoryAddress, system_message: Dict[str, Any]
|
|
101
113
|
) -> None:
|
|
@@ -25,10 +25,6 @@ class HierarchicalTeam:
|
|
|
25
25
|
self.root = root
|
|
26
26
|
self.hierarchy = hierarchy
|
|
27
27
|
|
|
28
|
-
# Validate that root is in the hierarchy if it has children,
|
|
29
|
-
# or at least that the structure makes sense.
|
|
30
|
-
# (We assume the user constructs the dict correctly for now)
|
|
31
|
-
|
|
32
28
|
def run(
|
|
33
29
|
self,
|
|
34
30
|
user_input: str,
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentify-core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Framework-agnostic AI agent library for building single and multi-agent systems
|
|
5
5
|
Author-email: Fabian M <fabian@example.com>
|
|
6
6
|
License: MIT
|
|
@@ -30,11 +30,11 @@ Requires-Dist: redis>=4.0.0; extra == "redis"
|
|
|
30
30
|
Provides-Extra: tools
|
|
31
31
|
Requires-Dist: requests>=2.25.0; extra == "tools"
|
|
32
32
|
Provides-Extra: ui
|
|
33
|
-
Requires-Dist: gradio
|
|
33
|
+
Requires-Dist: gradio==5.49.1; extra == "ui"
|
|
34
34
|
Provides-Extra: all
|
|
35
35
|
Requires-Dist: redis>=4.0.0; extra == "all"
|
|
36
36
|
Requires-Dist: requests>=2.25.0; extra == "all"
|
|
37
|
-
Requires-Dist: gradio
|
|
37
|
+
Requires-Dist: gradio==5.49.1; extra == "all"
|
|
38
38
|
Provides-Extra: dev
|
|
39
39
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
40
40
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
@@ -66,6 +66,10 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
66
66
|
- **Memory service and isolation**
|
|
67
67
|
Pluggable backends (in-memory, Redis, …) with per-use-case policies (TTL, maximum messages, etc.), plus optional memory isolation so each agent can maintain its own conversation history for scalability and privacy.
|
|
68
68
|
|
|
69
|
+
- **Reasoning Models**
|
|
70
|
+
Configure the model's thinking depth, safely merge `model_kwargs`, automatically store
|
|
71
|
+
"Chain of Thought" in conversation history, and log reasoning steps in real-time for visibility.
|
|
72
|
+
|
|
69
73
|
- **Tools and actions**
|
|
70
74
|
Type-annotated tool interface, straightforward registration of custom tools.
|
|
71
75
|
|
|
@@ -79,12 +83,12 @@ Agentify is a Python library for building and orchestrating AI agents, from simp
|
|
|
79
83
|
## Installation
|
|
80
84
|
|
|
81
85
|
```bash
|
|
82
|
-
pip install agentify
|
|
86
|
+
pip install agentify-core
|
|
83
87
|
```
|
|
84
88
|
|
|
85
89
|
For optional features:
|
|
86
90
|
```bash
|
|
87
|
-
pip install agentify[all] # Installs all optional dependencies
|
|
91
|
+
pip install agentify-core[all] # Installs all optional dependencies
|
|
88
92
|
```
|
|
89
93
|
|
|
90
94
|
## Quick Start
|
|
@@ -94,16 +98,18 @@ from agentify import BaseAgent, AgentConfig, MemoryService, MemoryAddress
|
|
|
94
98
|
from agentify.memory.stores import InMemoryStore
|
|
95
99
|
|
|
96
100
|
# 1. Create memory service
|
|
97
|
-
memory = MemoryService(store=InMemoryStore())
|
|
101
|
+
memory = MemoryService(store=InMemoryStore(), log_enabled=True, max_log_length=100)
|
|
98
102
|
addr = MemoryAddress(conversation_id="session_1")
|
|
99
103
|
|
|
100
104
|
# 2. Create an Agent
|
|
101
105
|
agent = BaseAgent(
|
|
102
106
|
config=AgentConfig(
|
|
103
|
-
name="
|
|
104
|
-
system_prompt="You are a helpful
|
|
107
|
+
name="ReasoningAgent",
|
|
108
|
+
system_prompt="You are a helpful assistant.",
|
|
105
109
|
provider="openai",
|
|
106
|
-
model_name="gpt-
|
|
110
|
+
model_name="gpt-5",
|
|
111
|
+
reasoning_effort="high", # optional param:"low", "medium", "high"
|
|
112
|
+
model_kwargs={"max_completion_tokens": 5000} # Pass model-specific params
|
|
107
113
|
),
|
|
108
114
|
memory=memory,
|
|
109
115
|
memory_address=addr
|
|
@@ -30,6 +30,8 @@ agentify/multi_agent/hierarchical.py
|
|
|
30
30
|
agentify/multi_agent/pipeline.py
|
|
31
31
|
agentify/multi_agent/team.py
|
|
32
32
|
agentify/multi_agent/tool_wrapper.py
|
|
33
|
+
agentify/utils/__init__.py
|
|
34
|
+
agentify/utils/style.py
|
|
33
35
|
agentify_core.egg-info/PKG-INFO
|
|
34
36
|
agentify_core.egg-info/SOURCES.txt
|
|
35
37
|
agentify_core.egg-info/dependency_links.txt
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agentify-core"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Framework-agnostic AI agent library for building single and multi-agent systems"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -48,14 +48,14 @@ tools = [
|
|
|
48
48
|
|
|
49
49
|
# UI y demos
|
|
50
50
|
ui = [
|
|
51
|
-
"gradio
|
|
51
|
+
"gradio==5.49.1",
|
|
52
52
|
]
|
|
53
53
|
|
|
54
54
|
# Todas las extensiones
|
|
55
55
|
all = [
|
|
56
56
|
"redis>=4.0.0",
|
|
57
57
|
"requests>=2.25.0",
|
|
58
|
-
"gradio
|
|
58
|
+
"gradio==5.49.1",
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
# Desarrollo y testing
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|