Skip to content

Agent-driven integration setup: one spec-driven action tool instead of one per integration #4169

Description

@muddlebee

Problem

An integration can be configured from two surfaces today:

Surface Coverage
opensre onboard (wizard) ~32 integrations
opensre integrations setup <service> 45 integrations
Interactive shell / agent 0

Asking the agent to "set up Telegram" does not work. #4071 proposes to fix that with a hand-written configure_telegram action tool — one action tool, for one integration. Repeating that shape 45 times is not a plausible path, and each copy would re-implement prompting, validation, and persistence.

What makes a generic version possible

integrations/setup_flow.py introduced IntegrationSetupSpec — a declarative description of what an integration needs:

TELEGRAM_SETUP = IntegrationSetupSpec(
    service="telegram",
    fields=(
        SetupField(name="bot_token", label="Telegram bot token",
                   env_var="TELEGRAM_BOT_TOKEN", secret=True),
        SetupField(name="default_chat_id", label="Default chat ID",
                   env_var="TELEGRAM_DEFAULT_CHAT_ID"),
    ),
    verify=verify_telegram,
    resolve=_resolve_default_chat_id,
)

That is exactly the metadata an agent needs to drive setup conversationally: which fields to ask for, which are required, which must be masked, and what to call them. So a single configure_integration action tool can serve every integration that has a spec, instead of one action tool per integration.

This depends on specs existing, which is #4168.

Constraint to design around first: secrets in chat history

A credential typed into a chat message is persisted by that chat platform. In the local terminal REPL that is acceptable. Through the Slack or Telegram gateway it means a bot token sits in a channel's history indefinitely, outside OpenSRE's control and outside its masking layer.

SetupField.secret already marks which fields this applies to. Options, roughly in order of preference:

  1. Refuse secret fields on remote surfaces. The agent collects non-secret fields, then tells the user to run opensre integrations setup <service> locally for the credential. Setup still gets easier without moving secrets through chat.
  2. Gate the whole tool to the local interactive shell. Simplest to reason about; gives up remote setup entirely.
  3. Accept secrets everywhere with a warning. Not recommended — the warning does not remove the message from the channel.

This should be decided before the tool is built, not retrofitted.

Scope

  • A configure_integration action tool driven by the spec, not per-integration copies.
  • Field collection over multiple turns: the agent asks for what is missing, accepts what the user supplies, re-asks on a validation failure. apply_setup already returns a SetupOutcome with a renderable detail, so failures come back as sentences the agent can relay.
  • Execution gating. This is a mutating action that writes credentials to disk, so it needs allow_tool / execution_allowed plus side_effect_level / requires_approval / approval_reason, per surfaces/interactive_shell/AGENTS.md ("Action Selection And Execution"). feat(interactive-shell): set up Telegram from a pasted token via a gated action tool (#3933) #4071 currently has none of these.
  • Surface policy per the secrets constraint above.
  • Tests for the allowed, denied, and confirmation-required paths (required by the same package rule).
  • Docs page plus a docs/docs.json entry.

Note: no regex/keyword intent routing around the action-agent path — surfaces/interactive_shell/AGENTS.md prohibits it. Selection goes through the action agent like any other action.

Relationship to other work

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions