dacp 0.1.0__tar.gz → 0.3.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.
dacp-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,369 @@
1
+ Metadata-Version: 2.4
2
+ Name: dacp
3
+ Version: 0.3.0
4
+ Summary: Declarative Agent Communication Protocol - A protocol for managing LLM/agent communications and tool function calls
5
+ Author-email: Andrew Whitehouse <andrew.whitehouse@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/andrewwhitehouse/dacp
8
+ Project-URL: Repository, https://github.com/andrewwhitehouse/dacp
9
+ Project-URL: Documentation, https://github.com/andrewwhitehouse/dacp#readme
10
+ Project-URL: Issues, https://github.com/andrewwhitehouse/dacp/issues
11
+ Keywords: llm,agent,communication,protocol,ai,ml
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.25.0
28
+ Requires-Dist: pyyaml>=5.4.0
29
+ Provides-Extra: openai
30
+ Requires-Dist: openai>=1.0.0; extra == "openai"
31
+ Provides-Extra: anthropic
32
+ Requires-Dist: anthropic>=0.18.0; extra == "anthropic"
33
+ Provides-Extra: local
34
+ Requires-Dist: requests>=2.25.0; extra == "local"
35
+ Provides-Extra: all
36
+ Requires-Dist: openai>=1.0.0; extra == "all"
37
+ Requires-Dist: anthropic>=0.18.0; extra == "all"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
41
+ Requires-Dist: black>=22.0.0; extra == "dev"
42
+ Requires-Dist: flake8>=4.0.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
44
+ Requires-Dist: types-requests>=2.25.0; extra == "dev"
45
+ Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # DACP - Declarative Agent Communication Protocol
49
+
50
+ A Python library for managing LLM/agent communications and tool function calls following the OAS Open Agent Specification.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install -e .
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ```python
61
+ import dacp
62
+
63
+ # Create an orchestrator to manage agents
64
+ orchestrator = dacp.Orchestrator()
65
+
66
+ # Create and register an agent
67
+ class MyAgent:
68
+ def handle_message(self, message):
69
+ return {"response": f"Hello {message.get('name', 'World')}!"}
70
+
71
+ agent = MyAgent()
72
+ orchestrator.register_agent("my-agent", agent)
73
+
74
+ # Send a message to the agent
75
+ response = orchestrator.send_message("my-agent", {"name": "Alice"})
76
+ print(response) # {"response": "Hello Alice!"}
77
+
78
+ # Use built-in tools
79
+ result = dacp.file_writer("./output/greeting.txt", "Hello, World!")
80
+ print(result["message"]) # "Successfully wrote 13 characters to ./output/greeting.txt"
81
+
82
+ # Use intelligence providers (supports multiple LLM providers)
83
+ intelligence_config = {
84
+ "engine": "anthropic",
85
+ "model": "claude-3-haiku-20240307",
86
+ "api_key": "your-api-key" # or set ANTHROPIC_API_KEY env var
87
+ }
88
+ response = dacp.invoke_intelligence("What is the weather like today?", intelligence_config)
89
+
90
+ # Or use the legacy call_llm function for OpenAI
91
+ response = dacp.call_llm("What is the weather like today?")
92
+ ```
93
+
94
+ ## Features
95
+
96
+ - **Agent Orchestration**: Central management of multiple agents with message routing
97
+ - **Tool Registry**: Register and manage custom tools for LLM agents
98
+ - **Built-in Tools**: Includes a `file_writer` tool that automatically creates parent directories
99
+ - **LLM Integration**: Built-in support for OpenAI models (extensible)
100
+ - **Protocol Parsing**: Parse and validate agent responses
101
+ - **Tool Execution**: Safe execution of registered tools
102
+ - **Conversation History**: Track and query agent interactions
103
+ - **OAS Compliance**: Follows Open Agent Specification standards
104
+
105
+ ## API Reference
106
+
107
+ ### Orchestrator
108
+
109
+ - `Orchestrator()`: Create a new orchestrator instance
110
+ - `register_agent(agent_id: str, agent) -> None`: Register an agent
111
+ - `unregister_agent(agent_id: str) -> bool`: Remove an agent
112
+ - `send_message(agent_id: str, message: Dict) -> Dict`: Send message to specific agent
113
+ - `broadcast_message(message: Dict, exclude_agents: List[str] = None) -> Dict`: Send message to all agents
114
+ - `get_conversation_history(agent_id: str = None) -> List[Dict]`: Get conversation history
115
+ - `clear_history() -> None`: Clear conversation history
116
+ - `get_session_info() -> Dict`: Get current session information
117
+
118
+ ### Tools
119
+
120
+ - `register_tool(tool_id: str, func)`: Register a new tool
121
+ - `run_tool(tool_id: str, args: Dict) -> dict`: Execute a registered tool
122
+ - `TOOL_REGISTRY`: Access the current tool registry
123
+ - `file_writer(path: str, content: str) -> dict`: Write content to file, creating directories automatically
124
+
125
+ ### Intelligence (Multi-Provider LLM Support)
126
+
127
+ - `invoke_intelligence(prompt: str, config: dict) -> str`: Call any supported LLM provider
128
+ - `validate_config(config: dict) -> bool`: Validate intelligence configuration
129
+ - `get_supported_engines() -> list`: Get list of supported engines
130
+
131
+ ### LLM (Legacy)
132
+
133
+ - `call_llm(prompt: str, model: str = "gpt-4") -> str`: Call OpenAI (legacy function)
134
+
135
+ ### Protocol
136
+
137
+ - `parse_agent_response(response: str | dict) -> dict`: Parse agent response
138
+ - `is_tool_request(msg: dict) -> bool`: Check if message is a tool request
139
+ - `get_tool_request(msg: dict) -> tuple[str, dict]`: Extract tool request details
140
+ - `wrap_tool_result(name: str, result: dict) -> dict`: Wrap tool result for agent
141
+ - `is_final_response(msg: dict) -> bool`: Check if message is a final response
142
+ - `get_final_response(msg: dict) -> dict`: Extract final response
143
+
144
+ ## Agent Development
145
+
146
+ ### Creating an Agent
147
+
148
+ Agents must implement a `handle_message` method:
149
+
150
+ ```python
151
+ import dacp
152
+
153
+ class GreetingAgent:
154
+ def handle_message(self, message):
155
+ name = message.get("name", "World")
156
+ task = message.get("task")
157
+
158
+ if task == "greet":
159
+ return {"response": f"Hello, {name}!"}
160
+ elif task == "farewell":
161
+ return {"response": f"Goodbye, {name}!"}
162
+ else:
163
+ return {"error": f"Unknown task: {task}"}
164
+
165
+ # Register the agent
166
+ orchestrator = dacp.Orchestrator()
167
+ agent = GreetingAgent()
168
+ orchestrator.register_agent("greeter", agent)
169
+
170
+ # Use the agent
171
+ response = orchestrator.send_message("greeter", {
172
+ "task": "greet",
173
+ "name": "Alice"
174
+ })
175
+ print(response) # {"response": "Hello, Alice!"}
176
+ ```
177
+
178
+ ### Agent Base Class
179
+
180
+ You can also inherit from the `Agent` base class:
181
+
182
+ ```python
183
+ import dacp
184
+
185
+ class MyAgent(dacp.Agent):
186
+ def handle_message(self, message):
187
+ return {"processed": message}
188
+ ```
189
+
190
+ ### Tool Requests from Agents
191
+
192
+ Agents can request tool execution by returning properly formatted responses:
193
+
194
+ ```python
195
+ class ToolUsingAgent:
196
+ def handle_message(self, message):
197
+ if message.get("task") == "write_file":
198
+ return {
199
+ "tool_request": {
200
+ "name": "file_writer",
201
+ "args": {
202
+ "path": "./output/agent_file.txt",
203
+ "content": "Hello from agent!"
204
+ }
205
+ }
206
+ }
207
+ return {"response": "Task completed"}
208
+
209
+ # The orchestrator will automatically execute the tool and return results
210
+ orchestrator = dacp.Orchestrator()
211
+ agent = ToolUsingAgent()
212
+ orchestrator.register_agent("file-agent", agent)
213
+
214
+ response = orchestrator.send_message("file-agent", {"task": "write_file"})
215
+ # Tool will be executed automatically
216
+ ```
217
+
218
+ ## Intelligence Configuration
219
+
220
+ DACP supports multiple LLM providers through the `invoke_intelligence` function. Configure different providers using a configuration dictionary:
221
+
222
+ ### OpenAI
223
+
224
+ ```python
225
+ import dacp
226
+
227
+ openai_config = {
228
+ "engine": "openai",
229
+ "model": "gpt-4", # or "gpt-3.5-turbo", "gpt-4-turbo", etc.
230
+ "api_key": "your-openai-key", # or set OPENAI_API_KEY env var
231
+ "endpoint": "https://api.openai.com/v1", # optional, uses default
232
+ "temperature": 0.7, # optional, default 0.7
233
+ "max_tokens": 150 # optional, default 150
234
+ }
235
+
236
+ response = dacp.invoke_intelligence("Explain quantum computing", openai_config)
237
+ ```
238
+
239
+ ### Anthropic (Claude)
240
+
241
+ ```python
242
+ anthropic_config = {
243
+ "engine": "anthropic",
244
+ "model": "claude-3-haiku-20240307", # or other Claude models
245
+ "api_key": "your-anthropic-key", # or set ANTHROPIC_API_KEY env var
246
+ "endpoint": "https://api.anthropic.com", # optional, uses default
247
+ "temperature": 0.7,
248
+ "max_tokens": 150
249
+ }
250
+
251
+ response = dacp.invoke_intelligence("Write a poem about AI", anthropic_config)
252
+ ```
253
+
254
+ ### Azure OpenAI
255
+
256
+ ```python
257
+ azure_config = {
258
+ "engine": "azure",
259
+ "model": "gpt-4", # Your deployed model name
260
+ "api_key": "your-azure-key", # or set AZURE_OPENAI_API_KEY env var
261
+ "endpoint": "https://your-resource.openai.azure.com", # or set AZURE_OPENAI_ENDPOINT env var
262
+ "api_version": "2024-02-01" # optional, default provided
263
+ }
264
+
265
+ response = dacp.invoke_intelligence("Analyze this data", azure_config)
266
+ ```
267
+
268
+ ### Local LLMs (Ollama, etc.)
269
+
270
+ ```python
271
+ # For Ollama (default local setup)
272
+ local_config = {
273
+ "engine": "local",
274
+ "model": "llama2", # or any model available in Ollama
275
+ "endpoint": "http://localhost:11434/api/generate", # Ollama default
276
+ "temperature": 0.7,
277
+ "max_tokens": 150
278
+ }
279
+
280
+ # For custom local APIs
281
+ custom_local_config = {
282
+ "engine": "local",
283
+ "model": "custom-model",
284
+ "endpoint": "http://localhost:8080/generate", # Your API endpoint
285
+ "temperature": 0.7,
286
+ "max_tokens": 150
287
+ }
288
+
289
+ response = dacp.invoke_intelligence("Tell me a story", local_config)
290
+ ```
291
+
292
+ ### Configuration from OAS YAML
293
+
294
+ You can load configuration from OAS (Open Agent Specification) YAML files:
295
+
296
+ ```python
297
+ import yaml
298
+ import dacp
299
+
300
+ # Load config from YAML file
301
+ with open('agent_config.yaml', 'r') as f:
302
+ config = yaml.safe_load(f)
303
+
304
+ intelligence_config = config.get('intelligence', {})
305
+ response = dacp.invoke_intelligence("Hello, AI!", intelligence_config)
306
+ ```
307
+
308
+ ### Installation for Different Providers
309
+
310
+ Install optional dependencies for the providers you need:
311
+
312
+ ```bash
313
+ # For OpenAI
314
+ pip install dacp[openai]
315
+
316
+ # For Anthropic
317
+ pip install dacp[anthropic]
318
+
319
+ # For all providers
320
+ pip install dacp[all]
321
+
322
+ # For local providers (requests is already included in base install)
323
+ pip install dacp[local]
324
+ ```
325
+
326
+ ## Built-in Tools
327
+
328
+ ### file_writer
329
+
330
+ The `file_writer` tool automatically creates parent directories and writes content to files:
331
+
332
+ ```python
333
+ import dacp
334
+
335
+ # This will create the ./output/ directory if it doesn't exist
336
+ result = dacp.file_writer("./output/file.txt", "Hello, World!")
337
+
338
+ if result["success"]:
339
+ print(f"File written: {result['path']}")
340
+ print(f"Message: {result['message']}")
341
+ else:
342
+ print(f"Error: {result['error']}")
343
+ ```
344
+
345
+ **Features:**
346
+ - ✅ Automatically creates parent directories
347
+ - ✅ Handles Unicode content properly
348
+ - ✅ Returns detailed success/error information
349
+ - ✅ Safe error handling
350
+
351
+ ## Development
352
+
353
+ ```bash
354
+ # Install development dependencies
355
+ pip install -e .[dev]
356
+
357
+ # Run tests
358
+ pytest
359
+
360
+ # Format code
361
+ black .
362
+
363
+ # Lint code
364
+ flake8
365
+ ```
366
+
367
+ ## License
368
+
369
+ MIT License
dacp-0.3.0/README.md ADDED
@@ -0,0 +1,322 @@
1
+ # DACP - Declarative Agent Communication Protocol
2
+
3
+ A Python library for managing LLM/agent communications and tool function calls following the OAS Open Agent Specification.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install -e .
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ import dacp
15
+
16
+ # Create an orchestrator to manage agents
17
+ orchestrator = dacp.Orchestrator()
18
+
19
+ # Create and register an agent
20
+ class MyAgent:
21
+ def handle_message(self, message):
22
+ return {"response": f"Hello {message.get('name', 'World')}!"}
23
+
24
+ agent = MyAgent()
25
+ orchestrator.register_agent("my-agent", agent)
26
+
27
+ # Send a message to the agent
28
+ response = orchestrator.send_message("my-agent", {"name": "Alice"})
29
+ print(response) # {"response": "Hello Alice!"}
30
+
31
+ # Use built-in tools
32
+ result = dacp.file_writer("./output/greeting.txt", "Hello, World!")
33
+ print(result["message"]) # "Successfully wrote 13 characters to ./output/greeting.txt"
34
+
35
+ # Use intelligence providers (supports multiple LLM providers)
36
+ intelligence_config = {
37
+ "engine": "anthropic",
38
+ "model": "claude-3-haiku-20240307",
39
+ "api_key": "your-api-key" # or set ANTHROPIC_API_KEY env var
40
+ }
41
+ response = dacp.invoke_intelligence("What is the weather like today?", intelligence_config)
42
+
43
+ # Or use the legacy call_llm function for OpenAI
44
+ response = dacp.call_llm("What is the weather like today?")
45
+ ```
46
+
47
+ ## Features
48
+
49
+ - **Agent Orchestration**: Central management of multiple agents with message routing
50
+ - **Tool Registry**: Register and manage custom tools for LLM agents
51
+ - **Built-in Tools**: Includes a `file_writer` tool that automatically creates parent directories
52
+ - **LLM Integration**: Built-in support for OpenAI models (extensible)
53
+ - **Protocol Parsing**: Parse and validate agent responses
54
+ - **Tool Execution**: Safe execution of registered tools
55
+ - **Conversation History**: Track and query agent interactions
56
+ - **OAS Compliance**: Follows Open Agent Specification standards
57
+
58
+ ## API Reference
59
+
60
+ ### Orchestrator
61
+
62
+ - `Orchestrator()`: Create a new orchestrator instance
63
+ - `register_agent(agent_id: str, agent) -> None`: Register an agent
64
+ - `unregister_agent(agent_id: str) -> bool`: Remove an agent
65
+ - `send_message(agent_id: str, message: Dict) -> Dict`: Send message to specific agent
66
+ - `broadcast_message(message: Dict, exclude_agents: List[str] = None) -> Dict`: Send message to all agents
67
+ - `get_conversation_history(agent_id: str = None) -> List[Dict]`: Get conversation history
68
+ - `clear_history() -> None`: Clear conversation history
69
+ - `get_session_info() -> Dict`: Get current session information
70
+
71
+ ### Tools
72
+
73
+ - `register_tool(tool_id: str, func)`: Register a new tool
74
+ - `run_tool(tool_id: str, args: Dict) -> dict`: Execute a registered tool
75
+ - `TOOL_REGISTRY`: Access the current tool registry
76
+ - `file_writer(path: str, content: str) -> dict`: Write content to file, creating directories automatically
77
+
78
+ ### Intelligence (Multi-Provider LLM Support)
79
+
80
+ - `invoke_intelligence(prompt: str, config: dict) -> str`: Call any supported LLM provider
81
+ - `validate_config(config: dict) -> bool`: Validate intelligence configuration
82
+ - `get_supported_engines() -> list`: Get list of supported engines
83
+
84
+ ### LLM (Legacy)
85
+
86
+ - `call_llm(prompt: str, model: str = "gpt-4") -> str`: Call OpenAI (legacy function)
87
+
88
+ ### Protocol
89
+
90
+ - `parse_agent_response(response: str | dict) -> dict`: Parse agent response
91
+ - `is_tool_request(msg: dict) -> bool`: Check if message is a tool request
92
+ - `get_tool_request(msg: dict) -> tuple[str, dict]`: Extract tool request details
93
+ - `wrap_tool_result(name: str, result: dict) -> dict`: Wrap tool result for agent
94
+ - `is_final_response(msg: dict) -> bool`: Check if message is a final response
95
+ - `get_final_response(msg: dict) -> dict`: Extract final response
96
+
97
+ ## Agent Development
98
+
99
+ ### Creating an Agent
100
+
101
+ Agents must implement a `handle_message` method:
102
+
103
+ ```python
104
+ import dacp
105
+
106
+ class GreetingAgent:
107
+ def handle_message(self, message):
108
+ name = message.get("name", "World")
109
+ task = message.get("task")
110
+
111
+ if task == "greet":
112
+ return {"response": f"Hello, {name}!"}
113
+ elif task == "farewell":
114
+ return {"response": f"Goodbye, {name}!"}
115
+ else:
116
+ return {"error": f"Unknown task: {task}"}
117
+
118
+ # Register the agent
119
+ orchestrator = dacp.Orchestrator()
120
+ agent = GreetingAgent()
121
+ orchestrator.register_agent("greeter", agent)
122
+
123
+ # Use the agent
124
+ response = orchestrator.send_message("greeter", {
125
+ "task": "greet",
126
+ "name": "Alice"
127
+ })
128
+ print(response) # {"response": "Hello, Alice!"}
129
+ ```
130
+
131
+ ### Agent Base Class
132
+
133
+ You can also inherit from the `Agent` base class:
134
+
135
+ ```python
136
+ import dacp
137
+
138
+ class MyAgent(dacp.Agent):
139
+ def handle_message(self, message):
140
+ return {"processed": message}
141
+ ```
142
+
143
+ ### Tool Requests from Agents
144
+
145
+ Agents can request tool execution by returning properly formatted responses:
146
+
147
+ ```python
148
+ class ToolUsingAgent:
149
+ def handle_message(self, message):
150
+ if message.get("task") == "write_file":
151
+ return {
152
+ "tool_request": {
153
+ "name": "file_writer",
154
+ "args": {
155
+ "path": "./output/agent_file.txt",
156
+ "content": "Hello from agent!"
157
+ }
158
+ }
159
+ }
160
+ return {"response": "Task completed"}
161
+
162
+ # The orchestrator will automatically execute the tool and return results
163
+ orchestrator = dacp.Orchestrator()
164
+ agent = ToolUsingAgent()
165
+ orchestrator.register_agent("file-agent", agent)
166
+
167
+ response = orchestrator.send_message("file-agent", {"task": "write_file"})
168
+ # Tool will be executed automatically
169
+ ```
170
+
171
+ ## Intelligence Configuration
172
+
173
+ DACP supports multiple LLM providers through the `invoke_intelligence` function. Configure different providers using a configuration dictionary:
174
+
175
+ ### OpenAI
176
+
177
+ ```python
178
+ import dacp
179
+
180
+ openai_config = {
181
+ "engine": "openai",
182
+ "model": "gpt-4", # or "gpt-3.5-turbo", "gpt-4-turbo", etc.
183
+ "api_key": "your-openai-key", # or set OPENAI_API_KEY env var
184
+ "endpoint": "https://api.openai.com/v1", # optional, uses default
185
+ "temperature": 0.7, # optional, default 0.7
186
+ "max_tokens": 150 # optional, default 150
187
+ }
188
+
189
+ response = dacp.invoke_intelligence("Explain quantum computing", openai_config)
190
+ ```
191
+
192
+ ### Anthropic (Claude)
193
+
194
+ ```python
195
+ anthropic_config = {
196
+ "engine": "anthropic",
197
+ "model": "claude-3-haiku-20240307", # or other Claude models
198
+ "api_key": "your-anthropic-key", # or set ANTHROPIC_API_KEY env var
199
+ "endpoint": "https://api.anthropic.com", # optional, uses default
200
+ "temperature": 0.7,
201
+ "max_tokens": 150
202
+ }
203
+
204
+ response = dacp.invoke_intelligence("Write a poem about AI", anthropic_config)
205
+ ```
206
+
207
+ ### Azure OpenAI
208
+
209
+ ```python
210
+ azure_config = {
211
+ "engine": "azure",
212
+ "model": "gpt-4", # Your deployed model name
213
+ "api_key": "your-azure-key", # or set AZURE_OPENAI_API_KEY env var
214
+ "endpoint": "https://your-resource.openai.azure.com", # or set AZURE_OPENAI_ENDPOINT env var
215
+ "api_version": "2024-02-01" # optional, default provided
216
+ }
217
+
218
+ response = dacp.invoke_intelligence("Analyze this data", azure_config)
219
+ ```
220
+
221
+ ### Local LLMs (Ollama, etc.)
222
+
223
+ ```python
224
+ # For Ollama (default local setup)
225
+ local_config = {
226
+ "engine": "local",
227
+ "model": "llama2", # or any model available in Ollama
228
+ "endpoint": "http://localhost:11434/api/generate", # Ollama default
229
+ "temperature": 0.7,
230
+ "max_tokens": 150
231
+ }
232
+
233
+ # For custom local APIs
234
+ custom_local_config = {
235
+ "engine": "local",
236
+ "model": "custom-model",
237
+ "endpoint": "http://localhost:8080/generate", # Your API endpoint
238
+ "temperature": 0.7,
239
+ "max_tokens": 150
240
+ }
241
+
242
+ response = dacp.invoke_intelligence("Tell me a story", local_config)
243
+ ```
244
+
245
+ ### Configuration from OAS YAML
246
+
247
+ You can load configuration from OAS (Open Agent Specification) YAML files:
248
+
249
+ ```python
250
+ import yaml
251
+ import dacp
252
+
253
+ # Load config from YAML file
254
+ with open('agent_config.yaml', 'r') as f:
255
+ config = yaml.safe_load(f)
256
+
257
+ intelligence_config = config.get('intelligence', {})
258
+ response = dacp.invoke_intelligence("Hello, AI!", intelligence_config)
259
+ ```
260
+
261
+ ### Installation for Different Providers
262
+
263
+ Install optional dependencies for the providers you need:
264
+
265
+ ```bash
266
+ # For OpenAI
267
+ pip install dacp[openai]
268
+
269
+ # For Anthropic
270
+ pip install dacp[anthropic]
271
+
272
+ # For all providers
273
+ pip install dacp[all]
274
+
275
+ # For local providers (requests is already included in base install)
276
+ pip install dacp[local]
277
+ ```
278
+
279
+ ## Built-in Tools
280
+
281
+ ### file_writer
282
+
283
+ The `file_writer` tool automatically creates parent directories and writes content to files:
284
+
285
+ ```python
286
+ import dacp
287
+
288
+ # This will create the ./output/ directory if it doesn't exist
289
+ result = dacp.file_writer("./output/file.txt", "Hello, World!")
290
+
291
+ if result["success"]:
292
+ print(f"File written: {result['path']}")
293
+ print(f"Message: {result['message']}")
294
+ else:
295
+ print(f"Error: {result['error']}")
296
+ ```
297
+
298
+ **Features:**
299
+ - ✅ Automatically creates parent directories
300
+ - ✅ Handles Unicode content properly
301
+ - ✅ Returns detailed success/error information
302
+ - ✅ Safe error handling
303
+
304
+ ## Development
305
+
306
+ ```bash
307
+ # Install development dependencies
308
+ pip install -e .[dev]
309
+
310
+ # Run tests
311
+ pytest
312
+
313
+ # Format code
314
+ black .
315
+
316
+ # Lint code
317
+ flake8
318
+ ```
319
+
320
+ ## License
321
+
322
+ MIT License