Skip to content

feat(agent-core): run a runner as a client only with AGENT_WORKER=false - #493

Closed
pablochacin wants to merge 1 commit into
mainfrom
feat/agent-worker-env
Closed

pablochacin wants to merge 1 commit into
mainfrom
feat/agent-worker-env

Conversation

@pablochacin

Copy link
Copy Markdown

What and why

Adds AGENT_WORKER, which lets an agent process start runs without executing them.

With AGENT_WORKER=false or 0, BaseWorkflowRunner.start() creates only the workflow client and does not start the workflow runtime. The process starts runs and reads their state. A worker in another process of the same App ID executes them. Unset, or any other value, keeps today's behaviour.

This lets one agent run as a front end that serves requests, with separate workers that execute runs. The Amazon Bedrock AgentCore quickstart needs this, and currently vendors this change.

  • Workflows and activities are still registered when the process is not a worker. Registering opens no connection. It also sets the workflow name the client schedules by.
  • The LangGraph runner overrides shutdown(), so it gets the same guard.
  • Strands' DurableAgent does not read the variable. It has no front end, and its docstring now points to DaprWorkflowAgentRunner for a split deployment.

The variable is documented in the BaseWorkflowRunner class docstring.

How it was tested

  • New unit tests cover how AGENT_WORKER values are read and how start() and shutdown() behave, for the base runner and for the LangGraph runner.
  • uv run pytest tests -m "not integration": 1045 passed, 4 skipped.
  • Not run against a Dapr sidecar or Catalyst.

Checklist

  • uv run ruff format (no path arguments, so examples/ is covered too)
  • uv run flake8 diagrid tests --ignore=E501,F401,W503,E203,E704
  • uv run mypy --config-file mypy.ini
  • uv run pytest tests -m "not integration"
  • New or changed behaviour has tests
  • New files under diagrid/ carry the license header (no new files)
  • Commits are signed off (git commit -s)

🤖 Generated with Claude Code

With AGENT_WORKER set to false or 0, BaseWorkflowRunner.start() creates
only the workflow client and does not start the workflow runtime. The
process starts runs and reads their state, and a worker in another
process of the same App ID executes them. This lets an agent run as a
front end that serves requests, with separate workers, for example on
Amazon Bedrock AgentCore. Unset, or any other value, keeps the current
behaviour.

The LangGraph runner's own shutdown() gets the same guard. Strands'
DurableAgent does not read the variable; its docstring says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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