feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation#111
feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation#111
Conversation
…creation
Adds a new `create_artifact` tool that allows LLMs to autonomously create
artifacts without requiring custom task handler implementation.
Key features:
- Environment variable configuration: `CAPABILITIES_CREATE_ARTIFACT=true`
- Auto file-type detection based on content (JSON, HTML, XML, CSS, JS, MD, CSV, TXT)
- Integration with existing artifact helper infrastructure
- Comprehensive test coverage with 14 new test cases
- Backward compatibility maintained for existing toolbox usage
Usage:
```bash
export CAPABILITIES_CREATE_ARTIFACT=true
```
```go
agent := server.NewAgentBuilder(logger).
WithDefaultToolBox(&config.CapabilitiesConfig{CreateArtifact: true}).
Build()
```
The tool accepts `content` and `type="url"` parameters, auto-detects file types,
and returns downloadable URLs for created artifacts.
Fixes #109
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Eden Reich <edenreich@users.noreply.github.com>
|
Not a final version, I need to take this pull request offline and refactor this before it's considered for a review. It's a good kick start of the feature but Claude created also a lot of code smell. Will continue tomorrow. |
TODOs
|
|
@claude please fix the CI - it's failing and reduce the amount of unnecessary functions. Backward compatibility for internal functions is not important, also we're not in stable version yet so breaking changes are allowed. Also I don't want to have the CreateArtifact tool configurable on the capabilities (although this make sense, it's not a part of the official A2A spec). |
|
Claude finished @edenreich's task —— View job Fixing CI and Refactoring CreateArtifact Tool ✅I've successfully fixed the CI failures and refactored the CreateArtifact tool implementation by removing unnecessary functions and the capabilities-based configuration. Todo List:
What I've Done:
Changes Committed:
The refactored code is cleaner, removes the unnecessary backward compatibility functions, and moves the CreateArtifact configuration away from the A2A capabilities spec as requested. |
…tion and simplify API - Remove CreateArtifact from CapabilitiesConfig (not part of A2A spec) - Add EnableCreateArtifact to AgentConfig with AGENT_CLIENT_ENABLE_CREATE_ARTIFACT env var - Replace NewDefaultToolBoxWithCapabilities with NewDefaultToolBoxWithCreateArtifact - Simplify AgentBuilder.WithDefaultToolBox to use AgentConfig.EnableCreateArtifact - Update all tests to use simplified API - Fix formatting issues causing CI failures - Regenerate mocks to reflect interface changes Co-authored-by: Eden Reich <edenreich@users.noreply.github.com>
…messages in executeCreateArtifact Signed-off-by: Eden Reich <eden.reich@gmail.com>
…ated tests Signed-off-by: Eden Reich <eden.reich@gmail.com>
… for now Later we might be able to convert the toolbox to a tool orchestrator and manage it's execution patterns - sequential or parallel etc Signed-off-by: Eden Reich <eden.reich@gmail.com>
|
TODO - I need to create a basic example for this in artifacts directory. On another pull request I'll move all artifacts related examples to this directory, grouping them under one concept which is artifacts. |
- Introduced a new server for the Artifacts Autonomous Tool that allows an AI agent to autonomously create artifacts based on user requests. - Implemented configuration management via environment variables for server settings, agent details, and artifact storage options. - Integrated logging with zap for better debugging and monitoring. - Added support for streaming task handling, enabling real-time responses from the AI agent. - Established a graceful shutdown mechanism for the server and its components. Signed-off-by: Eden Reich <eden.reich@gmail.com>
…er and task handlers - Updated A2AServerBuilder interface and implementation to replace WithArtifactStorage with WithArtifactService. - Refactored DefaultBackgroundTaskHandler and DefaultStreamingTaskHandler to use ArtifactService instead of ArtifactStorageProvider. - Adjusted context keys for dependency injection to reflect the change from ArtifactHelper to ArtifactService. Signed-off-by: Eden Reich <eden.reich@gmail.com>
…istency Signed-off-by: Eden Reich <eden.reich@gmail.com>
|
Hey @Joshswooft, in case you have time for a review, I'm this time focusing only on create artifact tool rather than refactoring the skills. Leaving the skills for a future refactoring / improvements. I also extracted the tools to the toolbox (which is probably our future tools orchestrator). I've added a simple example that helps to demonstrate how that works. The built-in create artifact tool is optional, disabled by default. I need this change for the browser-agent, which I'm going to refactor and remove the write_to_csv tool. |
Signed-off-by: Eden Reich <eden.reich@gmail.com>
|
@Joshswooft I guess you are already away, I'll just merge it and worst case I can tweak it later because I want to test it with the n8n-agent, browser-agent and the documentation-agent - actually all of them need to generate artifacts. Next up, I'll update the Agent Definition Language CLI. Let me know if something caught your eyes in this PR and you would like to change it, and I'll surely refactor it on another PR. This feature I've tested a bunch of times, so I know it works. Also it's a lot of changes for review. |
|
🎉 This PR is included in version 0.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Adds a new
create_artifacttool that allows LLMs to autonomously create artifacts without requiring custom task handler implementation, along with comprehensive documentation and a complete working example.Key Features
AGENT_CLIENT_TOOLS_CREATE_ARTIFACT=trueConfiguration
Enable the tool via environment variable:
export AGENT_CLIENT_TOOLS_CREATE_ARTIFACT=trueOr via agent configuration:
Tool Parameters
content(required): Text content to save as artifacttype(required): Must be "url" - indicates downloadable URL availabilityfilename(required): Filename with extension (e.g., 'report.json', 'data.csv')name(optional): Artifact name (defaults to "Generated Content")Changes
Core Implementation
NewDefaultToolBox()WithDefaultToolBox()method toAgentBuilderToolBoxConfigtoAgentConfigfor tool configurationcreate_artifacttool with comprehensive validationDocumentation
docs/artifacts.mdexplaining:New Example:
artifacts-autonomous-toolBuild System
generate:mock:artifact-servicetask to Taskfile.ymlFixes #109
🤖 Generated with Claude Code