Skip to content

Use casesCoding agent

Put a coding agent inside your own product.

Start a session from your backend and stream what the agent does into your interface. It edits files, runs code and uses git in a sandbox of its own.

A session your users can watch, steer and stop.

The build

From an empty folder to a session in your product

  1. Scaffold the agent

    One command makes a project folder: the agent's file, its instructions and a place for your own code.

    Terminal
    $ evs init coding-agent
    Created agent project coding-agent/
    
      coding-agent/agent.yaml        agent config (model, tools, triggers)
      coding-agent/instructions.md   system prompt
      coding-agent/src/              project code executed in the agent sandbox
      coding-agent/skills/           markdown playbooks, loaded on demand
      coding-agent/subagents/        optional nested agent projects
    
    Next: cd coding-agent && evs deploy
  2. Give it its tools

    List the built-in tools it may use in its sandbox, and add a function from your own code for anything else.

    coding-agent/agent.yaml
    name: "coding-agent"
    description: Makes changes to the orders app
    model: claude-sonnet-5
    instructions: ./instructions.md
    
    tools:
      - sandbox_git_clone
      - sandbox_edit
      - sandbox_shell
    
    functions:
      open_pr:
        file: ./src/pull_request.ts
        export: openPullRequest
        description: Open a pull request for a branch
        parameters:
          type: object
          properties:
            branch:
              type: string
  3. Deploy it

    The folder becomes a revision of the agent. Deploying again after a change makes the next one.

    Terminal
    $ evs deploy
    
    Deployed coding-agent. Try it:
      evs agents run coding-agent "hello"
  4. Start a session from your backend

    A session is one piece of work for one of your users. Your backend creates it with the agent's id.

    backend.py
    import os
    from everstack import Everstack
    
    client = Everstack(
        base_url=os.environ["EVERSTACK_BASE_URL"],
        api_key=os.environ["EVERSTACK_API_KEY"],
    )
    
    created = client.agents.sessions.create(agent_id=AGENT_ID)
    session_id = created["session"]["id"]
  5. Stream a turn into your interface

    Send what the user asked for. The call yields the model's output and each tool call as it happens, for you to pass on.

    backend.py
    events = client.agents.sessions.run_turn_stream(
        session_id,
        user_input="Add a CSV export to the orders page.",
    )
    for event in events:
        send_to_browser(event)
  6. Let the user steer it

    A message sent while the agent works changes its course without starting again. Cancelling is one call too.

    backend.py
    client.agents.sessions.steer(
        session_id,
        role="user",
        content="Use the existing table component.",
    )
    
    # Or stop it
    client.agents.sessions.cancel(session_id)
  7. Keep the record

    Each turn leaves a trace with its model calls, its sandbox commands and what they cost.

Good to know

Before you start

A session can be steered or cancelled while a turn is running.

Every deploy is a new revision, and a session stays on the revision it started with.

The agent can expose a port from its sandbox, which is how a preview is served.

Put Everstack in front of your next request

Run it yourself in a few minutes, or start on Everstack Cloud with your own provider keys.

Star on GitHubOpen source under Apache 2.0. A star helps others find it.