Skip to content

feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation#111

Merged
edenreich merged 9 commits intomainfrom
claude/issue-109-20251012-1956
Oct 14, 2025
Merged

feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation#111
edenreich merged 9 commits intomainfrom
claude/issue-109-20251012-1956

Conversation

@edenreich
Copy link
Copy Markdown
Contributor

@edenreich edenreich commented Oct 12, 2025

Adds a new create_artifact tool that allows LLMs to autonomously create artifacts without requiring custom task handler implementation, along with comprehensive documentation and a complete working example.

Key Features

  • Default toolbox integration: The tool is now part of the default toolbox and can be enabled via configuration
  • Environment variable configuration: AGENT_CLIENT_TOOLS_CREATE_ARTIFACT=true
  • Required filename parameter: Tool now requires explicit filename with extension
  • Auto file-type detection: MIME type detection based on file extension
  • Comprehensive test coverage: 14 new test cases covering all edge cases
  • Backward compatibility: Existing toolbox usage remains unchanged

Configuration

Enable the tool via environment variable:

export AGENT_CLIENT_TOOLS_CREATE_ARTIFACT=true

Or via agent configuration:

agentConfig := &config.AgentConfig{
    ToolBoxConfig: config.ToolBoxConfig{
        EnableCreateArtifact: true,
    },
}

agent := server.NewAgentBuilder(logger).
    WithConfig(agentConfig).
    WithDefaultToolBox().
    Build()

Tool Parameters

  • content (required): Text content to save as artifact
  • type (required): Must be "url" - indicates downloadable URL availability
  • filename (required): Filename with extension (e.g., 'report.json', 'data.csv')
  • name (optional): Artifact name (defaults to "Generated Content")

Changes

Core Implementation

  • Moved all default tools registration to NewDefaultToolBox()
  • Added WithDefaultToolBox() method to AgentBuilder
  • Added ToolBoxConfig to AgentConfig for tool configuration
  • Implemented create_artifact tool with comprehensive validation
  • Added artifact helper context integration
  • Updated all tests to use new toolbox configuration pattern

Documentation

  • Added comprehensive documentation in docs/artifacts.md explaining:
    • How to enable the CreateArtifact tool
    • Tool parameters and usage
    • Integration requirements
    • Example LLM usage patterns

New Example: artifacts-autonomous-tool

  • Complete working example demonstrating autonomous artifact creation
  • LLM decides when and what artifacts to create
  • Includes Docker Compose setup with Inference Gateway
  • Client demonstrates multiple use cases (JSON, CSV, Python scripts)
  • Comprehensive README with troubleshooting guide
  • Shows difference between autonomous tool vs custom task handlers

Build System

  • Added generate:mock:artifact-service task to Taskfile.yml
  • Updated mock generation workflow to include new interfaces

Fixes #109

🤖 Generated with Claude Code

…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>
@edenreich edenreich changed the title feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation WIP: feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation Oct 12, 2025
@edenreich
Copy link
Copy Markdown
Contributor Author

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.

@edenreich
Copy link
Copy Markdown
Contributor Author

edenreich commented Oct 12, 2025

TODOs

  • Reduce the amount of unnecessary functions created (backward compatibility pollution)
  • Check whether it's a good idea to use capabilities for defining the tool is enabled or not - this is not a part of the official A2A spec therefore I might be better just creating a separate config that is not adding to the official A2A spec

@edenreich
Copy link
Copy Markdown
Contributor Author

@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
Copy link
Copy Markdown
Contributor

claude bot commented Oct 12, 2025

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:

  • Check CI status to understand what's failing
  • Read current implementation to understand code structure
  • Remove capabilities-based configuration for CreateArtifact tool
  • Remove unnecessary functions (backward compatibility not needed)
  • Fix whitespace/formatting issues causing CI failure
  • Run linting and tests to ensure changes work
  • Commit the refactored changes

What I've Done:

  1. Removed capabilities-based configuration:

    • Removed CreateArtifact field from CapabilitiesConfig
    • Added EnableCreateArtifact to AgentConfig with environment variable AGENT_CLIENT_ENABLE_CREATE_ARTIFACT
    • This moves the configuration away from the A2A spec compliance issues
  2. Simplified API:

    • Replaced NewDefaultToolBoxWithCapabilities(capabilities *config.CapabilitiesConfig) with NewDefaultToolBoxWithCreateArtifact(enableCreateArtifact bool)
    • Updated AgentBuilder.WithDefaultToolBox() to use the new configuration from AgentConfig.EnableCreateArtifact
    • Removed unnecessary function parameters
  3. Updated all tests to use the new simplified API

  4. Regenerated mocks and fixed formatting issues that were causing CI failures

  5. All tests now pass and formatting is clean

Changes Committed:

  • server/config/config.go - Moved CreateArtifact config to AgentConfig
  • server/agent_builder.go - Simplified WithDefaultToolBox method
  • server/agent_toolbox.go - Replaced capabilities-based function with simpler API
  • server/agent_toolbox_test.go - Updated tests for new API
  • server/mocks/fake_agent_builder.go - Regenerated mock
  • docs/artifacts.md - Fixed formatting

The refactored code is cleaner, removes the unnecessary backward compatibility functions, and moves the CreateArtifact configuration away from the A2A capabilities spec as requested.

claude bot and others added 4 commits October 12, 2025 20:31
…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>
@edenreich edenreich changed the title WIP: feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation feat(toolbox): Implement CreateArtifact tool for autonomous artifact creation Oct 12, 2025
@edenreich
Copy link
Copy Markdown
Contributor Author

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>
@edenreich
Copy link
Copy Markdown
Contributor Author

edenreich commented Oct 14, 2025

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>
@edenreich
Copy link
Copy Markdown
Contributor Author

@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.

@edenreich edenreich merged commit 5fe9bf3 into main Oct 14, 2025
1 check passed
@edenreich edenreich deleted the claude/issue-109-20251012-1956 branch October 14, 2025 14:59
ig-semantic-release-bot bot added a commit that referenced this pull request Oct 14, 2025
## [0.15.0](v0.14.0...v0.15.0) (2025-10-14)

### ✨ Features

* **toolbox:** Implement CreateArtifact tool for autonomous artifact creation ([#111](#111)) ([5fe9bf3](5fe9bf3)), closes [#109](#109)
@ig-semantic-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.15.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@edenreich
Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement Create Artifact tool

1 participant