Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.6.0 instead.

boilerplate-devops-investigation-agent

The generic base for a DevOps investigation agent. Import it as devops_agent. A concrete agent installs this package and adds its own phase handlers, prompts and models. This package holds no prompts, models, accounts or log sources.

It provides:

  • the investigation-phase/1.0.0 protocol: JSON schemas (draft 2020-12) and pydantic models;
  • an async HTTP shell with the AgentCore contract: GET /ping and POST /invocations;
  • a result writer that appends one Run event to a Redis stream with XADD;
  • an invocation store, so a repeated request starts no new work;
  • a per-job limit and deadline guard that counts every model call and query;
  • a bounded CloudWatch Logs read tool;
  • optional parts: a Deep Agent factory (devops_agent.agent, extra deep-agent) and a Podman code worker (devops_agent.sandbox).

Install

pip install boilerplate-devops-investigation-agent
pip install "boilerplate-devops-investigation-agent[deep-agent]"  # optional Deep Agent factory

How a phase job runs

  1. The harness sends a request to POST /invocations.
  2. The shell checks it. Unknown fields, run_settings and a wrong phase and operation pair are refused with 422. A repeated invocation_id with a different body gets 409.
  3. The shell replies at once with the acknowledgement: {"protocol_version": "investigation-phase/1.0.0", "invocation_id": "...", "request_sha256": "...", "accepted": true}.
  4. The phase handler runs in a worker thread. /ping reports HealthyBusy until it ends.
  5. The writer appends exactly one entry to the request's result_stream: XADD <result_stream> * json <document>. The document is a canonical Run event of kind phase_result (format version 2). Its payload is the protocol result.

A handler failure, a limit or a passed deadline still writes one result, with status: "error" and error.kind set to handler, limit, deadline or invalid_output. A failed Redis write is logged and not retried, because a retry could write a second result.

Wire a concrete agent

import redis
from devops_agent.guard import PhaseGuard
from devops_agent.protocol import AgentInfo, PhaseRequest
from devops_agent.results import RedisResultWriter
from devops_agent.runtime import create_app


def frame(request: PhaseRequest, guard: PhaseGuard) -> dict:
    with guard.model_call(role="frame", model_id=MODEL_ID, max_microdollars=40_000) as call:
        reply = my_model.invoke(...)
        call.settle(input_tokens=..., output_tokens=..., microdollars=...)
    return {"directions": [...]}


app = create_app(
    {"FRAME": frame},  # one handler for each phase you serve
    writer=RedisResultWriter(redis.Redis.from_url(REDIS_URL, decode_responses=True)),
    agent=AgentInfo(version="1.0.0", commit=GIT_COMMIT, prompt_set_sha256=PROMPT_HASH),
)

Without a writer and an agent block, the app refuses every request with 503. A phase with no handler is refused with 503 too.

The guard is made from the request's limits and deadline. Before each call, it reserves the worst-case price, so spend never passes money_microdollars. A call that is not settled keeps its whole reservation as spent. The first refusal stops the guard, so no model call follows a limit. The guard's totals become the result's cost.

Give the CloudWatch tool the same guard, so each read counts as one query:

from devops_agent.tools import make_read_logs_tool

read_logs = make_read_logs_tool(
    logs_client, allowed_groups=set(request.source.log_groups),
    start_ms=start_ms, end_ms=end_ms, guard=guard,
)

Protocol files

The schemas ship inside the package:

from devops_agent.protocol import load_schema

load_schema("request")  # also "acknowledgement" and "result"

They live at devops_agent/protocol/investigation-phase/1.0.0/*.schema.json.

Phase Operation input output
FRAME frame leads directions: 1 to 4 objects with window and hint
QUALIFY qualify directions passed, reason
GENERATE action direction, diver_id result: status, content, hypotheses, evidence, handoff
RANK rank candidates: id, content, listing scores: id, score, reason for each candidate
EXECUTE execute selected: id, content, score; mode plan for plan_log, or proposal for medic_proposal

Directions, diver results, plans and proposals are open objects. Only their required top-level keys are checked.

Local development

Install uv, Make and Podman.

make setup
make test
make start   # an unwired shell at http://127.0.0.1:8080/ping

The Redis tests start a disposable Podman Redis on 127.0.0.1 from docker.io/library/redis:7-alpine and stop it afterwards. To use your own Podman Redis, set REDIS_URL=redis://127.0.0.1:<port>. Never use a host Redis.

Release

make publish checks that PYPI_APITOKEN starts with pypi-, builds the wheel and sdist, runs scripts/check_release_content.py on them, uploads with uv and tags v<version>. The content check refuses account ids, ARNs, AWS log group names, URLs that are not allowed, access keys, private keys and tokens.

License

MIT. See LICENSE.

Metadata

Release files for boilerplate-devops-investigation-agent 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boilerplate-devops-investigation-agent 0.2.0
File Size Uploaded Provenance Actions
boilerplate_devops_investigation_agent-0.2.0.tar.gz 39.4 kB Without provenance Details for boilerplate_devops_investigation_agent-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boilerplate-devops-investigation-agent 0.2.0
File Interpreter ABI Platform Actions
boilerplate_devops_investigation_agent-0.2.0-py3-none-any.whl Python 3 none any Details for boilerplate_devops_investigation_agent-0.2.0-py3-none-any.whl

Total release size: 67.1 kB

Release files / boilerplate_devops_investigation_agent-0.2.0.tar.gz

Download URL boilerplate_devops_investigation_agent-0.2.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
df4c24ff2def9c01c700af45753bafcb21199c13814cadf6eca6c1a494ed5d6e
BLAKE2b-256 checksum
How to use checksums
7d717572ed5441782aad8e5a057ac2ffe5064910aaf212b029c0856dea454f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / boilerplate_devops_investigation_agent-0.2.0-py3-none-any.whl

Download URL boilerplate_devops_investigation_agent-0.2.0-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b22713856e2122081e878dafdbfc7ec08f62624b86f4c278a51fef7b6b891f4
BLAKE2b-256 checksum
How to use checksums
aad4cd3356a497bb1912d7a0b5d3b720749dd5af2d87956ca86ca9296d6c400f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for boilerplate-devops-investigation-agent 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page