Back to Introducing the Vidbyte SDK
July 27th, 2026

Coding Agent

Coding

Tools

Workspace

Verification

6 min read

The problem

Coding agents fail when they guess. People want help that actually opens the project, edits the right files, and checks whether the change works. A Coding Agent built on the Vidbyte SDK is a controllable loop with tools — not a single-shot chat answer.

Success looks like: the agent states what it will change, uses tools against a workspace, returns a short summary of edits, and includes verification output when tests or compile steps ran.

Paste into Claude, Codex, Cursor, or another coding agent to scaffold this harness.

# Context: Vidbyte SDK

Vidbyte SDK is a Python package (import as `vidbyte`) for building agent workflows yourself.

Use it when you want to own the agent loop: system prompts, model/provider choice, tools, managed context, middleware, pipelines, tracing, evals, and multi-agent composition.

Core mental model:
1. Create an Agent or BaseAgent.
2. Attach a system prompt, provider/model, optional tools, context, middleware, and runtime choices.
3. Call run() or arun().
4. Let the SDK handle message assembly, tool schemas/calls, iteration limits, and optional pipelines.

Public package boundary: reusable local agent infrastructure. It does not ship private Vidbyte learning models or proprietary platform internals.

GitHub: https://github.com/cerredz/Vidbyte-SDK
Install: pip install vidbyte-sdk
Verify: python -c "from vidbyte import Agent, BaseAgent, tool; print(Agent, BaseAgent, callable(tool))"

# Install

Primary:
```bash
pip install vidbyte-sdk
```

From a checkout (pre-release / local development):
```bash
git clone https://github.com/cerredz/Vidbyte-SDK.git
cd Vidbyte-SDK
pip install -e .
```

# Task: Build a Coding Agent

Build a Vidbyte SDK coding agent that can inspect a project, propose changes, and verify work.

Scenario: A developer wants help implementing a small feature or fixing a failing test. The agent should read relevant files, make bounded edits (or propose patches), and run a verification command when possible.

The harness should:
- Accept a coding task in natural language
- Use workspace tools (list/read/write or patch) with a clear root directory
- Prefer small, reviewable changes
- Run tests or a compile check when available
- Return what changed and how it was verified

Constraints:
- Use Agent from the vidbyte package with tools
- Bound file access to a workspace root
- Never invent test results — report tool output
- Keep the first version simple enough to run locally

# Deliverable

Produce a small, runnable Python harness that uses the Vidbyte SDK (`vidbyte` package) to implement this agent. Prefer clear modules, a main entrypoint, and short comments that explain the control flow. Do not invent private Vidbyte backend APIs.

Build it step by step

  1. 01

    Create the coding agent

    Define an agent whose job is to implement carefully: inspect first, change little, verify always.

    from vidbyte import Agent
    
    agent = Agent(
        name="coding-agent",
        system_prompt=(
            "You are a careful coding agent. "
            "Inspect relevant files before editing. "
            "Prefer small diffs. Verify with tests when available. "
            "Report what changed and how you verified it."
        ),
        provider="openai",
        model_name="gpt-4.1",
    )
  2. 02

    Attach workspace tools

    Tools turn the agent into something that can touch a real project. Start with list/read helpers; add write or patch only with a workspace root.

    from pathlib import Path
    from vidbyte import tool
    
    ROOT = Path(".").resolve()
    
    @tool
    def list_files(relative_dir: str = ".") -> list[str]:
        """List files under the workspace root."""
        target = (ROOT / relative_dir).resolve()
        if not str(target).startswith(str(ROOT)):
            return ["error: path escapes workspace"]
        return [p.name for p in target.iterdir()]
    
    @tool
    def read_file(relative_path: str) -> str:
        """Read a UTF-8 text file from the workspace."""
        path = (ROOT / relative_path).resolve()
        if not str(path).startswith(str(ROOT)):
            return "error: path escapes workspace"
        return path.read_text(encoding="utf-8")
  3. 03

    Wire tools into the agent

    Pass the tools list when constructing the Agent so the model can call them during the loop.

    agent = Agent(
        name="coding-agent",
        system_prompt="Use tools to inspect the workspace before proposing edits.",
        provider="openai",
        model_name="gpt-4.1",
        tools=[list_files, read_file],
    )
  4. 04

    Add a verification tool

    A coding agent without a check is just autocomplete. Expose a tool that runs your project’s test or lint command and returns stdout/stderr.

    import subprocess
    from vidbyte import tool
    
    @tool
    def run_tests() -> str:
        """Run the project test command and return output."""
        completed = subprocess.run(
            ["python", "-m", "unittest", "discover", "-s", "tests"],
            capture_output=True,
            text=True,
        )
        return completed.stdout + completed.stderr
  5. 05

    Run a concrete coding task

    Give a narrow task first. Broad “rewrite the app” prompts are how agents thrash. Narrow tasks produce reviewable work.

    task = (
        "Find where user settings are loaded. "
        "Add a missing default for theme='dark' if absent. "
        "Run tests and summarize the result."
    )
    reply = await agent.arun(task)
    print(reply.content)