Skip to content

Add webhook action executor (HTTP POST)#8

Merged
jaredzwick merged 1 commit intomainfrom
webhook-executor
May 3, 2026
Merged

Add webhook action executor (HTTP POST)#8
jaredzwick merged 1 commit intomainfrom
webhook-executor

Conversation

@jaredzwick
Copy link
Copy Markdown
Collaborator

Summary

Ships the first concrete action executor for pypesdev/agents so agents can finally act, not just store. Per HIR-110 (Tier 1 #2 of HIR-105).

  • Agent.actions storage on disk is unchanged (Vec<String>); each entry is now interpreted as a typed JSON Action spec at execution time. Strings that don't parse fall through as Unrecognized instead of breaking the loop.
  • The first variant is webhook: HTTP POST a payload to a URL with optional headers; 2xx is success, anything else surfaces as a structured NonSuccessStatus error.
  • New CLI: pypes agent <NAME> run runs every stored action through the executor pipeline.
  • Tests use wiremockno external services required to run cargo test.

What's in the diff

  • src/executors/mod.rs — typed Action enum (#[serde(tag = "type")]), dispatch loop, parse helpers + tests.
  • src/executors/webhook.rsWebhookAction + execute_webhook + WebhookError. Header passthrough is the extent of auth handling (per the issue's "out of scope").
  • src/main.rsAgentCommands::Run wires the executor to the CLI.
  • src/lib.rs — new, so examples/downstream crates can use pypes::executors.
  • examples/webhook_executor.rs — end-to-end demo: spins up a tiny in-process axum receiver, runs the executor, prints the captured request.
  • examples/webhook.json — minimal agent definition with one webhook action; pair with pypes agent webhook-demo run.
  • README.md — new Action Executors → Webhook section + integration table flipped from experimental to shipped.
  • CHANGELOG.md — Unreleased entry.
  • Cargo.tomlreqwest (rustls, no native TLS) + wiremock dev-dep.

Example output

$ cargo run --example webhook_executor
→ stored action: {"headers":{"Authorization":"Bearer demo-token"},"payload":{"event":"agent.acted","n":1},"type":"webhook","url":"http://127.0.0.1:49207/hook"}
← webhook[0] status=200 body={"ok":true}
✓ mock receiver got 1 request(s):
    {"event":"agent.acted","n":1}

Test plan

  • cargo build — clean.
  • cargo test — 8 passed (4 new webhook executor + 2 new action parser + 2 pre-existing).
  • cargo run --example webhook_executor — receives the POST and prints captured payload.
  • CI pr_check workflow green.

Out of scope (separate tickets)

  • Cron executor (Tier 1 add primitive ui #3).
  • LLM executor (Tier 2).
  • Auth/secrets resolution beyond raw header passthrough.

🤖 Generated with Claude Code

First concrete action executor: each Agent.actions entry is now a
typed JSON spec like {"type":"webhook", ...}. The webhook executor
POSTs payload to url with optional headers, surfaces non-2xx as a
structured error, and is fully covered by wiremock-backed tests so
no external services are required.

- src/executors/{mod.rs, webhook.rs}: typed Action enum + dispatch
- src/main.rs: new `pypes agent <NAME> run` CLI subcommand
- src/lib.rs: expose modules to examples and downstream crates
- examples/webhook_executor.rs: end-to-end demo with in-process mock
- examples/webhook.json: agent definition with one webhook action
- README: Action Executors → Webhook section + integration table flip
- CHANGELOG: Unreleased entry

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@jaredzwick jaredzwick merged commit ca2b025 into main May 3, 2026
1 check passed
@jaredzwick jaredzwick deleted the webhook-executor branch May 3, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant