Skip to content

feat: expose workspace context - #1052

Merged
omeraplak merged 1 commit into
mainfrom
feat/expose-workspace-context
Feb 12, 2026
Merged

omeraplak merged 1 commit into
mainfrom
feat/expose-workspace-context

Conversation

@omeraplak

@omeraplak omeraplak commented Feb 12, 2026 •

Copy link
Copy Markdown
Member

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers


Summary by cubic

Expose the agent’s workspace to tool execution and add tool-aware live-eval payloads with a deterministic tool-call accuracy scorer. Also introduce an onToolError hook to customize serialized tool errors. Addresses #1046.

  • New Features
    • Added workspace on OperationContext and forwarded it to tool execute; the agent attaches its workspace automatically.
    • Added onToolError hook to override tool error payloads before serialization.
    • Live eval payload now includes messages, toolCalls, and toolResults; derives them from steps when not provided; exported AgentEvalToolCall and AgentEvalToolResult types.
    • Added createToolCallAccuracyScorerCode with single-tool and ordered-chain checks (strict or lenient).
    • Updated examples and docs to show options.workspace and tool-eval usage.

Written for commit 86be141. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • New Features

    • Workspace is now accessible to tools via the operation context, enabling tools to read workspace filesystem content and execute sandbox commands during execution.
  • Tests

    • Added test coverage for workspace functionality in tool execution.
  • Documentation

    • Updated documentation with examples showing how to access workspace within custom tools.

@changeset-bot

changeset-bot Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 86be141

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@voltagent/core Minor
@voltagent/scorers Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This change exposes a Workspace in the tool execution context by adding an optional workspace property to the OperationContext interface and wiring it through the Agent's operation context creation. Regression tests verify that tools can read workspace filesystem content and execute sandbox commands within the same execution.

Changes

Cohort / File(s) Summary
Type Definitions
packages/core/src/agent/types.ts, packages/core/src/agent/agent.spec-d.ts
Added optional workspace?: Workspace property to OperationContext interface and imported Workspace type for spec testing.
Agent Implementation
packages/core/src/agent/agent.ts
Wired workspace reference into operation context by adding workspace: this.workspace to the object returned by createOperationContext.
Test Coverage
packages/core/src/agent/agent.spec.ts
Added comprehensive regression test verifying that tools receive workspace context, can read filesystem, and execute sandbox commands within tool execution.
Documentation
website/docs/agents/context.md, website/docs/agents/tools.md, website/docs/workspaces/overview.md
Updated documentation with examples showing how tools access operationContext.workspace and interact with workspace filesystem and sandbox.
Changeset
.changeset/four-frogs-tease.md
Release notes documenting workspace exposure in tool execution context with test coverage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Hop, hop! Tools now glimpse the workspace wide,
Context carries filesystem and sandbox inside,
Files and commands, now within reach,
A fluffy lesson in what we teach! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/expose-workspace-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghost

This comment has been minimized.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 8 files

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

Deploying voltagent with  Cloudflare Pages  Cloudflare Pages

Latest commit: 86be141
Status:⚡️  Build in progress...

View logs

@omeraplak omeraplak linked an issue Feb 12, 2026 that may be closed by this pull request

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/core/src/workspace/skills/index.ts">

<violation number="1" location="packages/core/src/workspace/skills/index.ts:1641">
P2: `readFileContent` call is outside the `try/catch` block, so filesystem errors when reading the script will propagate as unhandled exceptions instead of returning a user-friendly error message. The `try/catch` below only covers `sandbox.execute`. Wrap the `readFileContent` call in the same `try/catch` or add a separate one, consistent with how `readSkillFile` handles this.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@Diluka

Diluka commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

8f0a3ff This commit is fine; the other commit seems unrelated to this issue.

@omeraplak
omeraplak changed the base branch from fix/workspace-skill to main February 12, 2026 16:50
@omeraplak
omeraplak changed the base branch from main to fix/workspace-skill February 12, 2026 16:56
@omeraplak
omeraplak force-pushed the feat/expose-workspace-context branch from e4da734 to 86be141 Compare February 12, 2026 21:08
@omeraplak
omeraplak changed the base branch from fix/workspace-skill to main February 12, 2026 21:08
@omeraplak

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 12, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@omeraplak
omeraplak merged commit 156c98e into main Feb 12, 2026
20 of 21 checks passed
@omeraplak
omeraplak deleted the feat/expose-workspace-context branch February 12, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Workspace context support for tool calls (fetch from sandbox)

2 participants