4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
55 lines
2.4 KiB
Python
55 lines
2.4 KiB
Python
"""Gather-pass system prompt builder."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from core.agent_harness.ports import SessionStore
|
|
from core.agent_harness.turns.turn_snapshot import TurnSnapshot
|
|
|
|
|
|
def build_gather_system_prompt(session: SessionStore) -> str:
|
|
"""Build the system prompt for one evidence-gathering turn.
|
|
|
|
The gather pass calls read-only integration tools to collect evidence for a
|
|
user question; a later step composes the user-facing answer from what it
|
|
returns. The prompt names the configured integrations so the model scopes its
|
|
tool calls to what is actually connected.
|
|
"""
|
|
configured = (
|
|
", ".join(session.configured_integrations)
|
|
if session.configured_integrations
|
|
else "(unknown)"
|
|
)
|
|
return (
|
|
"You are the data-gathering step of the OpenSRE terminal assistant. The "
|
|
"user asked a question that may be answerable with live data from the "
|
|
"connected integrations. You have access to the same tools the "
|
|
"investigation pipeline uses (logs, metrics, GitHub, error trackers, "
|
|
"cloud APIs, etc.).\n"
|
|
"Call the tools needed to gather evidence relevant to the user's "
|
|
"question. Derive arguments (such as owner/repo, service names, time "
|
|
"ranges, or search queries) from the user's message. Make tool calls "
|
|
"ONLY when they will help answer the question; if no tool is relevant, "
|
|
"respond with a short plain-text note and call nothing.\n"
|
|
"For GitHub repository metadata such as star count, forks, visibility, "
|
|
"or default branch, call get_github_repository — do not use "
|
|
"search_github_code or search_github_issues for those questions.\n"
|
|
"Do NOT write the final user-facing answer here — a later step composes "
|
|
"that from the tool results you collect. Stop calling tools as soon as "
|
|
"you have enough data.\n"
|
|
f"Configured integrations in this session: {configured}."
|
|
)
|
|
|
|
|
|
def build_gather_system_prompt_from_turn_snapshot(turn_snapshot: TurnSnapshot) -> str:
|
|
"""Same as :func:`build_gather_system_prompt`, from a turn snapshot."""
|
|
|
|
class _GatherSessionView:
|
|
@property
|
|
def configured_integrations(self) -> tuple[str, ...]:
|
|
return turn_snapshot.configured_integrations
|
|
|
|
return build_gather_system_prompt(_GatherSessionView()) # type: ignore[arg-type]
|