Skip to main content

Stigmer Agent Runner — Temporal worker for AI agent execution

Project description

Agent Runner

Python Temporal worker service that executes Graphton agents for Stigmer agent execution.

Quick Start

Docker (Recommended)

# Build and run in container (requires Docker or Podman)
make build-image VERSION=dev-local
make run-local

# View logs
make logs

See Docker Guide for complete container documentation.

Local Python Development

# Install dependencies
poetry install

# Set required environment variables
export TEMPORAL_SERVICE_ADDRESS=localhost:7233
export STIGMER_BACKEND_ENDPOINT=localhost:8080
export AUTH0_DOMAIN=stigmer.auth0.com
export AUTH0_AUDIENCE=https://api.stigmer.ai
export MACHINE_ACCOUNT_CLIENT_ID=your-client-id
export MACHINE_ACCOUNT_CLIENT_SECRET=your-client-secret
export DAYTONA_API_KEY=your-daytona-api-key

# Run worker
python main.py

Execution Modes

The agent-runner supports multiple execution modes via the run.sh launcher script:

1. Production Mode (Extracted Binaries)

Runs from extracted binaries in ~/.stigmer/data/bin/agent-runner/

# Daemon automatically sets STIGMER_AGENT_RUNNER_WORKSPACE
STIGMER_AGENT_RUNNER_WORKSPACE=/path/to/extracted/agent-runner ./run.sh

2. Bazel Mode

Runs via Bazel build system:

bazel run //backend/services/agent-runner
# BUILD_WORKSPACE_DIRECTORY is set automatically by Bazel

3. Development Mode

Runs from source tree (detects workspace by finding MODULE.bazel):

cd backend/services/agent-runner
./run.sh  # Automatically finds workspace root

The run.sh script determines the workspace root (where pyproject.toml lives) in this precedence order:

  1. STIGMER_AGENT_RUNNER_WORKSPACE (production/explicit)
  2. BUILD_WORKSPACE_DIRECTORY (Bazel)
  3. Directory tree walking (development)

What It Does

Agent Runner is a Python Temporal worker that:

  • Executes Graphton agents - Creates agents at runtime and processes user messages
  • Manages sandboxes - Session-based Daytona sandbox lifecycle for file persistence
  • Streams updates - Real-time execution updates to stigmer-service via gRPC
  • Handles skills - Downloads artifacts, extracts to /bin/skills/{hash}/, injects SKILL.md into prompts
  • Merges environments - Layers multiple environment configurations

Architecture

Execution Flow

Temporal Workflow (Java) → Python Activities → Graphton Agent
                      ↓
                 gRPC Status Updates → stigmer-service → MongoDB/Redis

Key Features:

  • Real-time status updates every N events
  • Progressive visibility (messages, tool calls, phase)
  • Session-based sandbox reuse

Resource Resolution

AgentExecution → Session → AgentInstance → Agent → Skills

See Architecture Documentation for complete details.

Development

Type Checking

# Run type checking
make build

Type checking runs automatically in CI before Docker builds.

Environment Variables

Variable Description Required
TEMPORAL_SERVICE_ADDRESS Temporal server address Yes
STIGMER_BACKEND_ENDPOINT Stigmer backend gRPC endpoint Yes
AUTH0_DOMAIN Auth0 tenant domain Yes
AUTH0_AUDIENCE Auth0 API audience Yes
MACHINE_ACCOUNT_CLIENT_ID Machine account client ID Yes
MACHINE_ACCOUNT_CLIENT_SECRET Machine account client secret Yes
DAYTONA_API_KEY Daytona API key Yes
REDIS_HOST Redis host No (default: localhost)
REDIS_PORT Redis port No (default: 6379)
LOG_LEVEL Logging level No (default: INFO)

Deployment

Docker Container

Local development:

# Build image
make build-image VERSION=dev-$(whoami)

# Run locally (requires Temporal + stigmer-server running)
export STIGMER_LLM_PROVIDER=openai
export STIGMER_LLM_MODEL=gpt-4
export OPENAI_API_KEY=your-key
make run-local

# View logs
make logs

# Stop
make stop

Publishing:

# Authenticate once
make docker-login

# Build and push multi-arch images (production)
make push-multiarch VERSION=1.2.3

See docs/docker.md for complete guide including:

  • Multi-stage build architecture
  • Security features (non-root user, health checks)
  • Volume mounts and persistence
  • Network configuration
  • Environment variables reference
  • Troubleshooting guide

Kubernetes

# Local
kubectl apply -k _kustomize/overlays/local

# Production
kubectl apply -k _kustomize/overlays/prod

Key Features

Session-Based Sandbox Reuse

Sandboxes are created once per session and reused across executions:

  • 90% cost reduction for multi-turn conversations
  • 2-27s saved per message after first message
  • File persistence across conversation turns

Environment Merging

Multiple environments are layered with proper overrides:

agent.env_spec → environment[0] → environment[1] → runtime_env

Skills Integration

Skills provide reusable capabilities (instructions + executable tools) to agents:

  • Artifact download & extraction: Downloads ZIP files from R2 storage, extracts to /bin/skills/{hash}/
  • SKILL.md injection: Full interface definition injected into system prompt with LOCATION headers
  • Executable access: Scripts and tools available at versioned paths
  • Graceful degradation: Falls back to SKILL.md-only if artifacts unavailable
  • Content-addressable storage: SHA256 hashing enables deduplication and immutable versioning

See Architecture: Skill Architecture for complete details.

Documentation

Complete documentation: docs/README.md

Key documents:

Related Services

  • stigmer-service - Java orchestration service with gRPC APIs
  • workflow-runner - Go Temporal workflow execution service

Dependencies

  • Graphton - Python framework for LLM agents
  • Temporal - Workflow orchestration platform
  • Daytona - Development sandbox platform

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stigmer_runner-0.3.4.tar.gz (655.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stigmer_runner-0.3.4-py3-none-any.whl (249.8 kB view details)

Uploaded Python 3

File details

Details for the file stigmer_runner-0.3.4.tar.gz.

File metadata

  • Download URL: stigmer_runner-0.3.4.tar.gz
  • Upload date:
  • Size: 655.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stigmer_runner-0.3.4.tar.gz
Algorithm Hash digest
SHA256 435f663de85352082ebe2fb628e6fae859b7b3d479b10e1e4ee454d19e2da67d
MD5 563ba9d8903556618c8d02a0a8499673
BLAKE2b-256 9203bda2e614baafa3bf261a279b491f9e0412c0cb59fa3547f64dec557c0b4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for stigmer_runner-0.3.4.tar.gz:

Publisher: release.python-runner.yaml on stigmer/stigmer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stigmer_runner-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: stigmer_runner-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 249.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stigmer_runner-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d534b2895a8e1261d462cca543076fd3b2c75c0e0cccb7ada9f5cc3c8dbefb6e
MD5 46063edc67d187dba75c512fa029e2cb
BLAKE2b-256 04fab57ebaa03d5ba9afd0e54485ab368be6e18adc2d57a0b54005ed539fec90

See more details on using hashes here.

Provenance

The following attestation bundles were made for stigmer_runner-0.3.4-py3-none-any.whl:

Publisher: release.python-runner.yaml on stigmer/stigmer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page