agentkit 0.0.2__tar.gz → 0.0.4__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.
Files changed (79) hide show
  1. {agentkit-0.0.2 → agentkit-0.0.4}/PKG-INFO +104 -8
  2. {agentkit-0.0.2 → agentkit-0.0.4}/README.md +97 -3
  3. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/agents/agent_manager.py +36 -9
  4. agentkit-0.0.4/agentkit/agents/base_agent.py +782 -0
  5. agentkit-0.0.4/agentkit/agents/human_agent.py +401 -0
  6. agentkit-0.0.4/agentkit/agents/simple_agent.py +99 -0
  7. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/agents/simple_agent_factory.py +41 -62
  8. agentkit-0.0.4/agentkit/agents/task_aware_agent.py +665 -0
  9. agentkit-0.0.4/agentkit/brains/__init__.py +8 -0
  10. agentkit-0.0.4/agentkit/brains/base_brain.py +215 -0
  11. agentkit-0.0.4/agentkit/brains/human_brain.py +73 -0
  12. agentkit-0.0.4/agentkit/brains/simple_brain.py +77 -0
  13. agentkit-0.0.4/agentkit/brains/tool_brain.py +1317 -0
  14. agentkit-0.0.4/agentkit/common/interfaces.py +99 -0
  15. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/constants.py +15 -12
  16. agentkit-0.0.4/agentkit/examples/agent_homes/.gitignore +4 -0
  17. agentkit-0.0.4/agentkit/examples/agent_homes/Assistant/AGENTS.md +1 -0
  18. agentkit-0.0.4/agentkit/examples/agent_homes/Human/AGENTS.md +3 -0
  19. agentkit-0.0.4/agentkit/examples/agent_homes/Julia/AGENTS.md +3 -0
  20. agentkit-0.0.4/agentkit/examples/agent_homes/Sophia/AGENTS.md +10 -0
  21. agentkit-0.0.4/agentkit/examples/agent_homes/Worker/AGENTS.md +22 -0
  22. agentkit-0.0.4/agentkit/examples/agent_runner_example.py +69 -0
  23. agentkit-0.0.4/agentkit/examples/agent_task_stack_example.py +172 -0
  24. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/config/example_api_config.json +1 -1
  25. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/config/human_agent.json +2 -2
  26. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/config/simple_chat.json +2 -2
  27. agentkit-0.0.4/agentkit/examples/config/sophia_task_agent.json +10 -0
  28. agentkit-0.0.4/agentkit/examples/config/worker_task_agent.json +10 -0
  29. agentkit-0.0.4/agentkit/examples/message_tool_example.py +86 -0
  30. agentkit-0.0.4/agentkit/examples/simple_chat_agent.py +40 -0
  31. agentkit-0.0.4/agentkit/examples/sophia_task_agent.py +128 -0
  32. agentkit-0.0.4/agentkit/examples/worker_echo_agent.py +117 -0
  33. agentkit-0.0.4/agentkit/functions/built_in_tools.py +192 -0
  34. agentkit-0.0.4/agentkit/functions/delegation_tools.py +139 -0
  35. agentkit-0.0.4/agentkit/functions/execution_tools.py +105 -0
  36. agentkit-0.0.4/agentkit/functions/filesystem_tools.py +148 -0
  37. agentkit-0.0.4/agentkit/functions/functions_registry.py +252 -0
  38. agentkit-0.0.4/agentkit/functions/reminder_tools.py +78 -0
  39. agentkit-0.0.4/agentkit/mcp/__init__.py +12 -0
  40. agentkit-0.0.4/agentkit/mcp/config.py +76 -0
  41. agentkit-0.0.4/agentkit/mcp/manager.py +302 -0
  42. agentkit-0.0.4/agentkit/memory/base_memory.py +120 -0
  43. agentkit-0.0.4/agentkit/memory/conversation/__init__.py +19 -0
  44. agentkit-0.0.4/agentkit/memory/conversation/context.py +161 -0
  45. agentkit-0.0.4/agentkit/memory/conversation/manager.py +215 -0
  46. agentkit-0.0.4/agentkit/memory/conversation/task.py +147 -0
  47. agentkit-0.0.4/agentkit/memory/memory_protocol.py +93 -0
  48. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/memory/simple_memory.py +5 -1
  49. agentkit-0.0.4/agentkit/memory/threaded_memory.py +199 -0
  50. agentkit-0.0.4/agentkit/planning/__init__.py +8 -0
  51. agentkit-0.0.4/agentkit/planning/planner.py +701 -0
  52. agentkit-0.0.4/agentkit/planning/state.py +232 -0
  53. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/processor.py +52 -5
  54. agentkit-0.0.4/agentkit/utils/__init__.py +18 -0
  55. agentkit-0.0.4/agentkit/utils/agent_home.py +50 -0
  56. agentkit-0.0.4/agentkit/utils/agent_runner.py +217 -0
  57. {agentkit-0.0.2 → agentkit-0.0.4}/pyproject.toml +9 -2
  58. agentkit-0.0.2/agentkit/agents/base_agent.py +0 -255
  59. agentkit-0.0.2/agentkit/agents/human_agent.py +0 -195
  60. agentkit-0.0.2/agentkit/agents/simple_agent.py +0 -137
  61. agentkit-0.0.2/agentkit/brains/base_brain.py +0 -53
  62. agentkit-0.0.2/agentkit/brains/human_brain.py +0 -22
  63. agentkit-0.0.2/agentkit/brains/simple_brain.py +0 -145
  64. agentkit-0.0.2/agentkit/examples/simple_chat_agent.py +0 -90
  65. agentkit-0.0.2/agentkit/functions/functions_registry.py +0 -138
  66. agentkit-0.0.2/agentkit/memory/__init__.py +0 -0
  67. agentkit-0.0.2/agentkit/memory/base_memory.py +0 -68
  68. agentkit-0.0.2/agentkit/memory/memory_protocol.py +0 -36
  69. {agentkit-0.0.2 → agentkit-0.0.4}/LICENSE +0 -0
  70. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/__init__.py +0 -0
  71. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/agents/__init__.py +0 -0
  72. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/.env.example +0 -0
  73. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/config/API_CONFIG.md +0 -0
  74. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/examples/config_agent.py +0 -0
  75. {agentkit-0.0.2/agentkit/brains → agentkit-0.0.4/agentkit/functions}/__init__.py +0 -0
  76. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/handlers.py +0 -0
  77. {agentkit-0.0.2/agentkit/functions → agentkit-0.0.4/agentkit/io}/__init__.py +0 -0
  78. {agentkit-0.0.2 → agentkit-0.0.4}/agentkit/io/console.py +0 -0
  79. {agentkit-0.0.2/agentkit/io → agentkit-0.0.4/agentkit/memory}/__init__.py +0 -0
@@ -1,25 +1,27 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: agentkit
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: A simple framework for creating distributed llm agent swarms
5
5
  License: MIT
6
+ License-File: LICENSE
6
7
  Keywords: artificial intelligence,agent frameworks,llm
7
8
  Author: Vikram Kumar
8
9
  Author-email: vik@japanvik.net
9
- Requires-Python: >=3.8
10
+ Requires-Python: >=3.10
10
11
  Classifier: Development Status :: 4 - Beta
11
12
  Classifier: License :: OSI Approved :: MIT License
12
13
  Classifier: Programming Language :: Python
13
14
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
20
  Requires-Dist: litellm
21
+ Requires-Dist: mcp (>=1.14,<2.0)
21
22
  Requires-Dist: networkkit (>=0.0.2)
22
23
  Requires-Dist: python-dotenv
24
+ Requires-Dist: rich
23
25
  Project-URL: Repository, https://github.com/japanvik/agentkit
24
26
  Description-Content-Type: text/markdown
25
27
 
@@ -37,7 +39,7 @@ Install `AgentKit` using pip:
37
39
  pip install agentkit
38
40
  ```
39
41
 
40
- Ensure you have Python 3.8 or higher installed to meet the compatibility requirements.
42
+ Ensure you have Python 3.10 or higher installed to meet the compatibility requirements.
41
43
 
42
44
  ## Features
43
45
 
@@ -49,6 +51,26 @@ Ensure you have Python 3.8 or higher installed to meet the compatibility require
49
51
 
50
52
  - **Built-in Logging and Monitoring**: Integrated logging tracks message flows and system activity, providing valuable insights during development and troubleshooting phases.
51
53
 
54
+ ### Model Context Protocol (MCP) Integration
55
+
56
+ - **Per-agent MCP tool catalogs**: Each agent can declare its own list of MCP servers. Tools discovered from those servers are automatically surfaced through the AgentKit functions registry, allowing LLM-driven planners to call them like any other function.
57
+ - **Namespace isolation**: Tools are exposed using a `<server>::<tool>` naming convention so that specialized agents can connect to different MCP stacks without name collisions.
58
+ - **Powered by the official SDK**: AgentKit now depends on the `mcp` package, ensuring first-class support for the Model Context Protocol standard and future enhancements.
59
+
60
+ Sample snippet from an agent configuration:
61
+
62
+ ```json
63
+ "mcp_servers": [
64
+ {
65
+ "name": "filesystem",
66
+ "transport": "stdio",
67
+ "command": "python",
68
+ "args": ["-m", "mcp_servers.fs"],
69
+ "namespace": "fs"
70
+ }
71
+ ]
72
+ ```
73
+
52
74
  ## Why AgentKit?
53
75
 
54
76
  AgentKit simplifies the creation and management of networked agent systems, making it an invaluable tool for a variety of innovative applications:
@@ -73,6 +95,70 @@ Aids in the simulation and modeling of complex systems to facilitate research an
73
95
 
74
96
  Refer to the `examples` directory to see a simple chat agent implementation. Comprehensive documentation will be provided soon!
75
97
 
98
+ ### Using the AgentRunner Utility
99
+
100
+ For simplified agent creation and lifecycle management, AgentKit provides the `AgentRunner` utility:
101
+
102
+ ```python
103
+ import asyncio
104
+ from pathlib import Path
105
+ from agentkit.utils import AgentRunner
106
+
107
+ async def main():
108
+ runner = AgentRunner(
109
+ name="Julia",
110
+ description="A friendly AI assistant",
111
+ model="ollama/qwen3",
112
+ agent_home=str(Path("agentkit/examples/agent_homes/Julia").resolve())
113
+ )
114
+
115
+ await runner.run()
116
+
117
+ if __name__ == "__main__":
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ This utility handles:
122
+ - Agent creation with sensible defaults
123
+ - Message receiver setup and registration
124
+ - Signal handling for graceful shutdown
125
+ - Proper resource cleanup
126
+
127
+ TODO: Add more examples of AgentRunner configuration options
128
+
129
+ ### Agent Home Convention
130
+
131
+ AgentKit now uses a per-agent home directory for durable state, working files, and prompt instructions.
132
+
133
+ Each configured agent must provide `agent_home`, and that directory must contain an `AGENTS.md` file. The content of `AGENTS.md` is loaded as the system prompt.
134
+
135
+ Expected layout:
136
+
137
+ ```text
138
+ <agent_home>/
139
+ AGENTS.md
140
+ state/
141
+ tasks/
142
+ workspace/
143
+ logs/
144
+ ```
145
+
146
+ The runtime ensures these subdirectories exist when the agent is loaded.
147
+
148
+ Example `sophia_task_agent.json`:
149
+
150
+ ```json
151
+ {
152
+ "name": "Sophia",
153
+ "description": "A thoughtful task-aware assistant who can plan, delegate, and execute tools.",
154
+ "agent_home": "../agent_homes/Sophia",
155
+ "model": "ollama/qwen3-coder:480b-cloud",
156
+ "planner_model": "ollama/qwen3-coder:480b-cloud",
157
+ "user_prompt": "Conversation history:\n{context}\nSophia:",
158
+ "bus_ip": "127.0.0.1"
159
+ }
160
+ ```
161
+
76
162
  ## Documentation
77
163
 
78
164
  Still in the works. Refer to the source docstrings for documentation for now.
@@ -97,7 +183,7 @@ To run a chat bot agent that utilizes the Data Bub for sending and receiving mes
97
183
  Ensure you have the latest version of the example files from the `examples` directory.
98
184
 
99
185
  2. **Configure the Agent**:
100
- Examine and modify the configuration file (`simple_chat.json`) to fit your setup. By default, the agent is configured to interact with [Ollama](https://ollama.com/) running on localhost.
186
+ Examine and modify the configuration file (`simple_chat.json`) to fit your setup. By default, the agent is configured to interact with [Ollama](https://ollama.com/) running on localhost. Ensure each agent has an `agent_home` path and that `AGENTS.md` exists there.
101
187
 
102
188
  Update the configuration settings for the model and identity as necessary. For using other LLMs like OpenAI's models, refer to the [Litellm documentation](https://docs.litellm.ai/docs/) for details on specifying API keys and model settings.
103
189
 
@@ -118,7 +204,17 @@ To interact with the LLM-powered chat bot above, launch the agent with the human
118
204
  python ./config_agent.py --config ./config/human_agent.json --loglevel WARN
119
205
  ```
120
206
 
121
- Once the command line prompt appears, begin typing your messages. The chat bot will respond according to the capabilities defined in its configuration.
207
+ Once the prompt appears, you can use a multi-agent chat-room style interface:
208
+
209
+ - Plain text sends to the current channel (broadcast as `ALL`)
210
+ - `/join <channel>` switches channels (default `#general`)
211
+ - `/dm <agent> <message>` sends a direct message
212
+ - `/reply <message>` replies to the most recent sender
213
+ - `/agents` lists discovered agents
214
+ - `/history [N]` shows recent timeline entries
215
+ - `/help` shows all commands
216
+
217
+ Japanese input/output is supported out of the box (UTF-8).
122
218
 
123
219
  ## Further Assistance
124
220
 
@@ -12,7 +12,7 @@ Install `AgentKit` using pip:
12
12
  pip install agentkit
13
13
  ```
14
14
 
15
- Ensure you have Python 3.8 or higher installed to meet the compatibility requirements.
15
+ Ensure you have Python 3.10 or higher installed to meet the compatibility requirements.
16
16
 
17
17
  ## Features
18
18
 
@@ -24,6 +24,26 @@ Ensure you have Python 3.8 or higher installed to meet the compatibility require
24
24
 
25
25
  - **Built-in Logging and Monitoring**: Integrated logging tracks message flows and system activity, providing valuable insights during development and troubleshooting phases.
26
26
 
27
+ ### Model Context Protocol (MCP) Integration
28
+
29
+ - **Per-agent MCP tool catalogs**: Each agent can declare its own list of MCP servers. Tools discovered from those servers are automatically surfaced through the AgentKit functions registry, allowing LLM-driven planners to call them like any other function.
30
+ - **Namespace isolation**: Tools are exposed using a `<server>::<tool>` naming convention so that specialized agents can connect to different MCP stacks without name collisions.
31
+ - **Powered by the official SDK**: AgentKit now depends on the `mcp` package, ensuring first-class support for the Model Context Protocol standard and future enhancements.
32
+
33
+ Sample snippet from an agent configuration:
34
+
35
+ ```json
36
+ "mcp_servers": [
37
+ {
38
+ "name": "filesystem",
39
+ "transport": "stdio",
40
+ "command": "python",
41
+ "args": ["-m", "mcp_servers.fs"],
42
+ "namespace": "fs"
43
+ }
44
+ ]
45
+ ```
46
+
27
47
  ## Why AgentKit?
28
48
 
29
49
  AgentKit simplifies the creation and management of networked agent systems, making it an invaluable tool for a variety of innovative applications:
@@ -48,6 +68,70 @@ Aids in the simulation and modeling of complex systems to facilitate research an
48
68
 
49
69
  Refer to the `examples` directory to see a simple chat agent implementation. Comprehensive documentation will be provided soon!
50
70
 
71
+ ### Using the AgentRunner Utility
72
+
73
+ For simplified agent creation and lifecycle management, AgentKit provides the `AgentRunner` utility:
74
+
75
+ ```python
76
+ import asyncio
77
+ from pathlib import Path
78
+ from agentkit.utils import AgentRunner
79
+
80
+ async def main():
81
+ runner = AgentRunner(
82
+ name="Julia",
83
+ description="A friendly AI assistant",
84
+ model="ollama/qwen3",
85
+ agent_home=str(Path("agentkit/examples/agent_homes/Julia").resolve())
86
+ )
87
+
88
+ await runner.run()
89
+
90
+ if __name__ == "__main__":
91
+ asyncio.run(main())
92
+ ```
93
+
94
+ This utility handles:
95
+ - Agent creation with sensible defaults
96
+ - Message receiver setup and registration
97
+ - Signal handling for graceful shutdown
98
+ - Proper resource cleanup
99
+
100
+ TODO: Add more examples of AgentRunner configuration options
101
+
102
+ ### Agent Home Convention
103
+
104
+ AgentKit now uses a per-agent home directory for durable state, working files, and prompt instructions.
105
+
106
+ Each configured agent must provide `agent_home`, and that directory must contain an `AGENTS.md` file. The content of `AGENTS.md` is loaded as the system prompt.
107
+
108
+ Expected layout:
109
+
110
+ ```text
111
+ <agent_home>/
112
+ AGENTS.md
113
+ state/
114
+ tasks/
115
+ workspace/
116
+ logs/
117
+ ```
118
+
119
+ The runtime ensures these subdirectories exist when the agent is loaded.
120
+
121
+ Example `sophia_task_agent.json`:
122
+
123
+ ```json
124
+ {
125
+ "name": "Sophia",
126
+ "description": "A thoughtful task-aware assistant who can plan, delegate, and execute tools.",
127
+ "agent_home": "../agent_homes/Sophia",
128
+ "model": "ollama/qwen3-coder:480b-cloud",
129
+ "planner_model": "ollama/qwen3-coder:480b-cloud",
130
+ "user_prompt": "Conversation history:\n{context}\nSophia:",
131
+ "bus_ip": "127.0.0.1"
132
+ }
133
+ ```
134
+
51
135
  ## Documentation
52
136
 
53
137
  Still in the works. Refer to the source docstrings for documentation for now.
@@ -72,7 +156,7 @@ To run a chat bot agent that utilizes the Data Bub for sending and receiving mes
72
156
  Ensure you have the latest version of the example files from the `examples` directory.
73
157
 
74
158
  2. **Configure the Agent**:
75
- Examine and modify the configuration file (`simple_chat.json`) to fit your setup. By default, the agent is configured to interact with [Ollama](https://ollama.com/) running on localhost.
159
+ Examine and modify the configuration file (`simple_chat.json`) to fit your setup. By default, the agent is configured to interact with [Ollama](https://ollama.com/) running on localhost. Ensure each agent has an `agent_home` path and that `AGENTS.md` exists there.
76
160
 
77
161
  Update the configuration settings for the model and identity as necessary. For using other LLMs like OpenAI's models, refer to the [Litellm documentation](https://docs.litellm.ai/docs/) for details on specifying API keys and model settings.
78
162
 
@@ -93,7 +177,17 @@ To interact with the LLM-powered chat bot above, launch the agent with the human
93
177
  python ./config_agent.py --config ./config/human_agent.json --loglevel WARN
94
178
  ```
95
179
 
96
- Once the command line prompt appears, begin typing your messages. The chat bot will respond according to the capabilities defined in its configuration.
180
+ Once the prompt appears, you can use a multi-agent chat-room style interface:
181
+
182
+ - Plain text sends to the current channel (broadcast as `ALL`)
183
+ - `/join <channel>` switches channels (default `#general`)
184
+ - `/dm <agent> <message>` sends a direct message
185
+ - `/reply <message>` replies to the most recent sender
186
+ - `/agents` lists discovered agents
187
+ - `/history [N]` shows recent timeline entries
188
+ - `/help` shows all commands
189
+
190
+ Japanese input/output is supported out of the box (UTF-8).
97
191
 
98
192
  ## Further Assistance
99
193
 
@@ -10,6 +10,7 @@ from typing import Any, Dict, List, Optional
10
10
  from networkkit.network import ZMQMessageReceiver
11
11
  from agentkit.agents.simple_agent_factory import simple_agent_factory
12
12
  from networkkit.messages import Message
13
+ from agentkit.utils.agent_home import apply_agent_home_convention
13
14
 
14
15
  class AgentManager:
15
16
  """
@@ -35,6 +36,7 @@ class AgentManager:
35
36
  try:
36
37
  with open(config_file, 'r') as f:
37
38
  config = json.load(f)
39
+ config["_config_dir"] = str(config_file.parent.resolve())
38
40
  return config
39
41
  except json.JSONDecodeError as e:
40
42
  logging.error(f"Error parsing configuration file: {e}")
@@ -69,19 +71,44 @@ class AgentManager:
69
71
 
70
72
  for agent_conf in agents_config:
71
73
  try:
74
+ config_dir = Path(self.config.get("_config_dir", ".")).resolve()
75
+ resolved_conf = apply_agent_home_convention(
76
+ agent_conf,
77
+ config_dir=config_dir,
78
+ )
79
+ # Extract required parameters
80
+ name = resolved_conf["name"]
81
+ description = resolved_conf["description"]
82
+ model = resolved_conf["model"]
83
+
84
+ # Extract optional parameters with defaults
85
+ agent_type = resolved_conf.get("agent_type", "SimpleAgent")
86
+ brain_type = resolved_conf.get("brain_type", "SimpleBrain")
87
+ memory_type = resolved_conf.get("memory_type", "SimpleMemory")
88
+ system_prompt = resolved_conf.get("system_prompt", "")
89
+ user_prompt = resolved_conf.get("user_prompt", "")
90
+ api_config = resolved_conf.get("api_config")
91
+ agent_home = resolved_conf.get("agent_home")
92
+ plugins_dir = self.config.get("plugins_dir", "plugins")
93
+
94
+ # Create agent with extracted parameters
72
95
  agent = simple_agent_factory(
73
- name=agent_conf["name"],
74
- description=agent_conf["description"],
75
- model=agent_conf["model"],
76
- system_prompt=agent_conf.get("system_prompt", ""),
77
- user_prompt=agent_conf.get("user_prompt", ""),
78
- agent_type=agent_conf.get("agent_type", "SimpleAgent"),
79
- brain_type=agent_conf.get("brain_type", "SimpleBrain"),
96
+ name=name,
97
+ description=description,
98
+ model=model,
99
+ system_prompt=system_prompt,
100
+ user_prompt=user_prompt,
101
+ agent_type=agent_type,
102
+ brain_type=brain_type,
103
+ memory_type=memory_type,
104
+ plugins_dir=plugins_dir,
80
105
  bus_ip=bus_ip,
81
- api_config=agent_conf.get("api_config")
106
+ api_config=api_config,
107
+ agent_home=agent_home,
108
+ config_dir=str(config_dir),
82
109
  )
83
110
  self.agents.append(agent)
84
- logging.info(f"Loaded agent: {agent_conf['name']}")
111
+ logging.info(f"Loaded agent: {name}")
85
112
  except KeyError as e:
86
113
  logging.error(f"Missing required agent configuration parameter: {e}")
87
114
  except Exception as e: