managed-deepagents is the PyPI package for authoring Managed Deep Agents in Python. It includes:
define_deep_agent , the Python authoring contract for managed agents.
define_schedule , the Python contract for managed cron schedules.
mda , the CLI used to build and deploy your agent to LangSmith.
managed_deepagents.runtime , the runtime helper used by generated managed entry modules.
This package requires Python 3.9 or newer. Each platform wheel bundles the prebuilt mda binary for its OS and CPU architecture and exposes it through the mda console script. This PyPI-installed CLI scaffolds and compiles Python projects only and vendors the Python runtime bundled with this wheel.
To start a new project, run mda init . In a terminal, the CLI asks you to name the agent:
Run mda init -i to initialize your agent interactively and optionally hand it off to a coding agent to build:
Choose a coding agent to continue in the new project, or select View raw prompt to copy the setup instructions.
For coding agents and other headless use, pass the project name:
mda init can shape the project up front — --instructions "..." (or --instructions-file ) writes the system prompt, --model picks the model, --memory agent opts into deployment-shared durable memory, --no-sandbox leaves out the sandbox, and -c slack (also --channel / --channels ) writes channels/slack.py . Every new project includes an identity.py that explicitly selects auth.langsmith_api_key() authentication.
Managed Deep Agent evals run in Harbor. Install uv and Docker before running them.
From the project root, initialize the eval workspace: mda evals init -i
From the project root, initialize the eval workspace:
Follow the coding-agent prompt to author tasks directly under evals/ / . The CLI creates the user-owned evals/harbor-job.json once and preserves later edits. .mda/evals/ is generated. A task may include an authored evals/ /identity.json fixture. It requires a non-empty user.id ; user.kind , user.email , and top-level groups , claims , and source.provider are optional. Keep it with the task, not in generated .mda/evals/ .
Follow the coding-agent prompt to author tasks directly under evals/ / . The CLI creates the user-owned evals/harbor-job.json once and preserves later edits. .mda/evals/ is generated. A task may include an authored evals/ /identity.json fixture. It requires a non-empty user.id ; user.kind , user.email , and top-level groups , claims , and source.provider are optional. Keep it with the task, not in generated .mda/evals/ .
Export LANGSMITH_API_KEY , LANGSMITH_WORKSPACE_ID when your credentials require it, and the model or tool credential variables used by the agent.
Export LANGSMITH_API_KEY , LANGSMITH_WORKSPACE_ID when your credentials require it, and the model or tool credential variables used by the agent.
From the same project root, run the pinned Harbor 0.21.0 command included at the end of the coding-agent prompt. The command loads MDAJobPlugin and LangSmithPlugin . It uses POSIX syntax on macOS/Linux and PowerShell on native Windows.
From the same project root, run the pinned Harbor 0.21.0 command included at the end of the coding-agent prompt. The command loads MDAJobPlugin and LangSmithPlugin . It uses POSIX syntax on macOS/Linux and PowerShell on native Windows.
From the same project root, inspect results: uv run --python 3 .12 --with 'harbor[langsmith]==0.21.0' harbor view .mda/evals/jobs
From the same project root, inspect results:
MDAJobPlugin compiles a fresh eval artifact at every Harbor job start. This POC keeps MDA's custom Harbor adapter; migration to Harbor's built-in LangGraph agent is deferred.
Create an agent.py that defines an agent :
define_deep_agent requires name and supports the create_deep_agent options except the platform-owned backend , store , checkpointer , system_prompt , and memory fields. Static agents use instructions.md and all discovered skills.
Export a sync or async factory as agent to select configuration per run:
The factory can select tools, middleware, instructions, skills, MCP definitions, a sandbox, and memory. Omitted selections use project resources. None disables an instruction, skill, MCP, sandbox, or memory selection for that run. Empty strings and arrays remain explicit selections. Select memory with define_memory(...) ; selected memory cannot use allow . Root memory.py remains the fallback.
On direct runs, execution_runtime.context is application context or None . On channel runs, it is None ; read the conversation from runtime.thread . ManagedServerRuntime[AppContext] preserves the application's context type. It extends the native langgraph_sdk.runtime.ServerRuntime variants with managed fields. access_context identifies the Agent Server operation that called the factory. During inspection, execution_runtime is None . Keep the factory repeatable and preserve graph structure and schemas. MDA skips managed resource reads and allocation. Context is application data; tools must check authorization.
mda build reads the inline literal name without calling the factory. Install all model integrations the factory can select.
To authenticate SDK and API requests with a LangSmith workspace key while retaining MDA's thread and store authorization, declare it explicitly:
Clients send the key as x-api-key . LangSmith Cloud supplies the verification endpoint and tenant configuration; do not add those platform-owned values to the project .env .
A personal access token identifies the LangSmith user who owns it. That caller is a person: it can use user-owned connections, is eligible for user memory under the user memory policy, and resolves to the same Agent Auth principal as that user in deployed Studio, so a connection made in Studio also works over the API. A service key carries no user and stays one workspace service principal, so every caller that shares it shares its threads and cannot use user-owned connections or user memory. To act for many end users from one server, use a trusted backend or validated-token identity instead.
On deploy, Context Hub stores harness files ( instructions.md , skills/** ). A root memory.py enables agent, assistant, and user memory independently:
Omit a layer to disable it. A layer with no allow callback uses its default policy. Agent memory is shared across callers and is available by default. Assistant memory is available by default and shared only by runs of the same assistant in this deployment. It requires the trusted assistant identity supplied by Agent Server; missing identity fails the run instead of using shared memory. Neither authored context nor a custom key callback can select another assistant. User memory requires a trusted person and defaults to managed Slack one-to-one DMs (the original provider event has channel_type == "im" ). Shared conversations, missing event data, and direct API runs get no user mount unless an authored policy allows it.
For compatibility, an autodiscovered root declaration can still use a sync or async allow(context) callback to replace its default policy. allow is deprecated and emits a warning; prefer selecting memory from a dynamic agent:
Verified Studio users get the declared user memory layer without calling its policy. Under mda dev , a personal LangSmith API key resolves the developer's langsmith-dev Agent Auth principal; memory stays in .mda/__contexthub__ . Deployed Studio uses the verified LangSmith user ID and stores memory in Context Hub.
When evaluated, each callback runs once before memory mounts, including interrupt resumes. Returning false removes only that layer's mount and hot memory for the run. If the context cannot satisfy the policy schema, MDA denies that layer without calling its policy. An error from the callback still fails the run. User policies cannot grant access to another person's memory or grant user memory to a service principal. Build, schema, and state inspection do not call memory policies.
The legacy scope option remains supported. Do not combine it with agent , assistant , or user .
Permitted hot memory is loaded once per run, on the first model call, and reused for subsequent model calls. It is not saved in thread state. This keeps the graph structure stable and prevents a later denied run from loading saved memory. A missing hot file stays empty until the first memory write.
The agent layer is mounted at /memories/agent/ . The assistant layer mounts /memories/assistant/ from an opaque per-deployment, per-assistant Context Hub repo. Assistant memory is separate from deployment-shared agent memory and per-person user memory. The user layer requires identity.py and is mounted from an opaque per-user Context Hub repo at /memories/user/ , keyed on the trusted caller principal. Each mount's AGENTS.md is injected every turn; other files are read on demand. Deploy never overwrites existing memories. A project without memory.py mounts no durable memory.
Mounting your own backends
routes mounts Deep Agents backends at path prefixes, as CompositeBackend(routes=...) does. A path under a prefix goes to that backend with the prefix stripped; every other path keeps the managed backend.
Prefixes must be absolute directories ( "/documents/" ) and cannot overlap the paths MDA mounts itself: /instructions.md , /skills/ , and /memories/ . Routes serve the file tools; shell commands in a sandbox do not see them.
Every Python agent can run its general-purpose subagent either way: blocking through task , or in the background through start_async_task . The agent picks per task, so there's nothing to declare. MDA builds the background copy as an extra graph, --general-purpose , from your own general-purpose subagent if you declare one (not a fork), keeping its skills , or else from the Deep Agents default, which loads the agent's skills. Like any async subagent, it can also be run directly as its own assistant, with the agent's tools but not its instructions or middleware. mda eval runs the blocking one only.
Mark a subagent with "async": True to run it in the background. MDA builds it as its own graph in the same deployment, and the agent starts it, checks on it, and reads its result while it keeps working:
The subagent runs under the caller's identity and uses the project's sandbox, identity, and connector declarations. When it leaves model , tools , permissions , or interrupt_on unset, it uses the agent's. It does not inherit the agent's middleware or memory. Like a sync subagent, it loads only the skills its skills key names: "skills": ["/skills/"] gives it the agent's skills.
When the project has a sandbox, the subagent works in the sandbox of the agent that started it, so both see the same files. MDA first checks that the subagent run's caller owns the starting agent's thread (a Slack conversation or a user), so a run can't name another caller's sandbox. The subagent only refreshes credentials in the shared sandbox; it never reruns workspace setup there or deletes it. If the starting agent hasn't created its sandbox yet, the subagent creates it, and the starting agent then uses that same sandbox.
When the subagent pauses for approval, the agent sees the task as waiting. If the agent was started from a Slack channel, the approval shows in that Slack thread, and the answer there resumes the subagent. Otherwise, answer it in the subagent's own thread. When a task finishes, the agent's it is posted to the same Slack thread. A subagent's runtime.thread is its starting agent's thread, so its tools and middleware can also post to that Slack thread through runtime.thread.origin.channel , for example to show progress. The subagent's own answer is not posted.
With tracing on, a subagent's runs appear in the starting agent's trace, under the call that started it. Nesting follows the trace headers on the request, so any caller allowed to start runs on this deployment can place its run inside another trace in the same workspace.
Each async subagent is its own graph, so any caller allowed to start runs on this deployment can also run it directly, as themselves. It doesn't get the agent's middleware, so don't rely on the agent's middleware to guard the tools it shares with a subagent, and don't give it looser interrupt_on or permissions than the agent that starts it.
Write async subagents in agent.py as dict literals, or names bound to one, so the build can find them without running your code. Other fields can come from code, as long as name and "async" come after any **spread : {**worker_spec("low"), "name": "low", "async": True} . mda build warns subagent entries it can't read.
Run context and channels
The runtime separates application data, trusted caller information, and the current channel delivery:
API callers supply application data through Agent Server's context parameter:
Direct API runs use your authored context_schema and native LangGraph context validation. On channel runs, tools, middleware, and authored factories receive None as context. Use runtime.thread.origin.channel.event for the typed event and runtime.thread.origin.channel.raw_event for optional provider data. The application schema stays on the graph, but its required fields do not apply to channel runs. Supplying a channel field in a direct API call does not establish a trusted channel source.
Agent Server passes the current delivery to MDA through its context input. MDA resolves the verified channel before it calls the authored factory and removes delivery data before native graph execution. MDA prepares memory access in the graph factory for each run or resume. Direct callers of the managed compiler must build a fresh graph with the execution's context; a compiled graph is scoped to that execution.
runtime.thread describes the thread the run belongs to ( ManagedThread ):
id is the LangGraph thread ID. An async subagent's thread is its starting agent's thread.
origin is the channel conversation the thread came from, or None . Its channel (a RuntimeChannel ) is the delivery that started the run. On a run that no channel message started, such as a resume from LangSmith Studio, a task notification that wakes the agent, or a scheduled run, it is the thread's last channel conversation. Then event and raw_event are None , except that a scheduled run has a schedule event. origin.sender is the participant who sent the latest message, or None when that was not a person.
participants lists the people who wrote in the thread, as ThreadParticipant(id, role) . The first person is the owner ; later people are member s. id is the same as runtime.server_info.principal.id .
Managed channel ingress records the origin and participants in thread metadata when a message arrives. They hold routing and principal IDs only, never message content. Only managed ingress can write them.
The channel facts are available even when the channel cannot send. post uses a private, verified target. The channel helper does not expose the target or let callers replace it.
runtime.channel is deprecated: use runtime.thread.origin.channel . It has the same value and is removed in 0.11.
The built-in Slack channel.post sends text content through Trigger. It rejects native payloads and content it cannot send. For channels that support native messages, set type to "native" and supply the JSON in native . For content messages, set type to "content" and supply content . Supply only the matching payload. Native JSON has no extra provider or payload wrapper. The channel helper has no address , update , or destination override. A post sends an additional message; the normal final agent remains automatic.
On Slack, post(message, new_thread=True) posts at top level in the same conversation instead, which starts a new Slack thread. Replies in it continue a thread of their own, also without a mention in thread mode. Add run= to start a run there at once, with a channel handler's run input, as the current run's person. The result also has thread_id and, on Slack, the message url :
When a run with a thread origin ends, MDA posts the run's answers to that origin. A Studio resume of a channel thread answers in the channel, and the run that a finished async task starts posts only its new answers. A run that stops for approval shows the approval in a Slack thread instead. An answer of exactly [quiet] is not posted. If a Slack post fails, the run fails; if an HTTP channel post fails, MDA logs the error and the run still succeeds.
Managed Slack channels save incoming files under /workspace/attachments/ and add upload_files(paths) so the agent can attach completed workspace files to its . This requires a managed sandbox. On each message, the runtime also checks up to five pages of Slack thread history for files, requesting 100 messages per page. This requires the bot's history scope for that conversation. Duplicate file IDs are processed once per run, and files already saved at the attachment path are reused. If history is unavailable or the scan limit is reached, the attachment status reports that files may be missing.
The event types are message , user_prompt_response , and interrupt_resume . Message events contain messages . Prompt responses contain action , optional value , and optional correlation_id . Resume events contain resume . For Trigger Slack deliveries, raw_event is the inner provider event. It excludes HTTP headers and the outer Trigger envelope. A resume can omit the raw event; MDA does not reuse the delivery's event.
For a prompt that answers an interrupt, put a shared ID on the prompt and on the interrupt value under INTERRUPT_CORRELATION_KEY . MDA uses correlation_id to select that interrupt. Without a correlation ID, an answer can resume the only pending interrupt that isn't a tool-call review; multiple pending interrupts require a match. Existing resume values are unchanged.
The managed runtime fields are available to authored tools and middleware, including declarative subagents, without an identity or sandbox declaration. Channel projects still require an identity declaration for trusted ingress. server_info preserves platform information and adds managed caller information when available. Its link.status currently reports not_required ; it does not perform an account-link lookup. Its source thread identifier retains the existing provider-thread/LangGraph-thread fallback behavior.
Self-hosted channel runtime configuration
Agent Server's MOUNT_PREFIX is honored by managed event routes and default loopback clients. Explicit MDA_CHANNEL_API_URL or LANGGRAPH_API_URL overrides must already include the deployment path.
Trigger-backed channels require LANGSMITH_MDA_TRIGGER_SERVER_URL and a deployment key ( LANGSMITH_API_KEY , or LANGCHAIN_API_KEY on self-hosted). The runtime prefers LANGSMITH_API_KEY when both are present.
If the Agent Auth token issuer differs from the runtime's LangSmith API URL, set OAUTH_AS_ISSUER in the deployment environment to the configured issuer (for example, ). The runtime verifies the exact issuer and fetches its public /.well-known/jwks.json ; it does not trust an issuer supplied by an incoming token. LangSmith must have signing keys configured, and the agent must be able to reach that public-key endpoint.
Setting up channels on deploy
mda deploy sets up the agent's Slack, GitHub and Linear channels. A channel already set up on the deployment is set up again before the new revision is uploaded, so a setup that fails stops the deploy before anything changes. A new channel, and every channel on a first deploy, is set up once the new revision is live. A deploy that sets up a new channel, such as the first one, can't use --no-wait ; once the channels are set up, later deploys can. To check the channels, or finish setting them up, without deploying, run mda channels setup .
Tool and middleware runtime types
Python requires 3.11 or later and includes Deep Agents, LangChain, and LangGraph. MCP provider packages remain optional.
Use ManagedToolRuntime[Context, State] for tools and tool-call hooks. Lifecycle and model hooks keep the native Runtime[Context] signature. Use isinstance(runtime, ManagedRuntime) to access MDA fields. Both preserve native fields and your declared context type. ManagedDeepAgentRuntime is an alias for the tool type. MDA adds server_info , channel , backend , and schedules ; channel and backend are optional.
channels.slack(...) receives Slack messages through Trigger Server. Each Slack thread is one conversation, and the run's is posted in it. trigger_mode decides which channel messages reach the app; direct messages always do:
"mention" : only messages that @-mention the agent. New Slack apps use this.
"thread" : one @-mention, then every later in that thread, so people mention the agent once.
"all" : every message in the channels the agent is in.
Under "thread" and "all" , the agent also gets messages that are not for it. If the agent answers exactly [quiet] , MDA posts nothing, so tell it in its instructions to answer [quiet] when it has nothing to add.
When trigger_mode is unset, a deployed agent keeps its current mode, except that an agent that drops "all" moves to "mention" . Redeploying with a new mode updates the existing Slack app. trigger_on_all_messages is deprecated; True is trigger_mode="all" .
The keys are "mention" , a channel message that @-mentions the app; "directMessage" ; and "message" , any other channel message, which only trigger_mode "thread" or "all" delivers. They're the same strings in the TypeScript runtime. Under those modes Slack sends a mention as a plain message, so the channel asks Slack once for the app's bot user, with the app's bot token, to tell a mention from a message. An unknown key raises. A message kind without a handler starts a run with the message, as without on_event . With trigger_mode="mention" , a "message" handler is never called, and defining the channel warns.
With a "mention" handler under trigger_mode "thread" , a only continues a thread the agent already ran on: when the handler declines a thread's mention, the thread's later replies start nothing until someone mentions the agent there again.
A handler gets the SlackMessageEvent ( text , user_id , channel_id , message_ts , thread_ts , files , Slack's own event as payload , and actor ) and its SlackChannelThread ( id , source_thread_key , channel.name ). It returns the run's input, as agent.invoke takes it, optionally with context , metadata and webhook as (input, options) , as the GitHub and Linear handlers do. None starts no run, and the app neither reacts nor replies. A handler that raises, or returns input the channel can't start, starts no run either; the error is logged without its message. The message's blocks and attachments are added to the handler's messages, and its files still reach /workspace/attachments/ . Interrupt resumes don't go through on_event ; a click on a button the agent posted does, as "interaction" : see Buttons your agent posts .
A handler may also be an endpoint of your service, a URL or an httpx.Request : Trigger Server gets its answer first, then MDA asks the service what the message starts. See Asking your service what to start .
multitask_strategy is what a message that starts a run does while its thread already runs: enqueue (the default) waits for the run and starts after it, interrupt cancels the run, keeping its progress, and starts at once, rollback cancels it and discards its progress, and reject starts nothing.
event.actor is the Slack user who sent the message, as Trigger Server read it from Slack's signed request: a SlackActor with id and team_id . team_id is their own workspace: in a Slack Connect channel, someone from another organization keeps theirs. It is None rather than guessed when Trigger Server names no one, such as an older Trigger Server or a bot's message, or when the check below fails.
Checked against the signed principal. Trigger Server sends actor as a plain field of the delivery. MDA asks Agent Auth for this user's principal in the app's workspace and keeps actor only when it matches the principal Agent Auth signed for the delivery. id is checked this way. A Slack Connect guest's own team is not.
Checked against the signed principal. Trigger Server sends actor as a plain field of the delivery. MDA asks Agent Auth for this user's principal in the app's workspace and keeps actor only when it matches the principal Agent Auth signed for the delivery. id is checked this way. A Slack Connect guest's own team is not.
Every channel's events carry actor in this shape, a ChannelActor ( SlackActor , GitHubActor or LinearActor ): provider and id , plus the provider's own fields. GitHub's is the webhook's sender ( name is its login, plus type and email ), and Linear's is who acted (plus type , name and email ); Slack's has no name or email, since Trigger Server's delivery names none. Endpoints get it as event["actor"] , with camelCase keys. It is personal data: MDA doesn't log it or add it to a run's metadata; add what you need through metadata yourself.
on_finish is called once when a message or an "interaction" is done, with the SlackEvent (a SlackMessageEvent or SlackInteractionEvent ), its SlackChannelThread , and how it finished, as Linear's on_finish is:
run : the message started a run, which ended with run["status"] ( success , error , timeout or interrupted ). interrupts lists the decisions the thread waits on.
skipped : no run started. The handler returned nothing or failed ( ignored ), or the thread was busy under multitask_strategy="reject" ( rejected ).
failed : MDA couldn't start the run, or lost track of it.
Use it to record which run answered which message in your own service, update memory after a run succeeds, or alert someone when one fails:
It runs in the background after the , and errors are logged. Interrupt resumes don't call it, and neither does a message Trigger Server will send again because its run couldn't start. Like channels.http 's, it runs in the deployment's process, so a restart loses it: set the run's webhook for anything you can't miss.
The status a run shows
While a run works, Slack shows Trigger Server's working phrases ("is thinking it through...", "reviewing your question..."). status shows yours instead, the way reactions picks the emoji: a value for every run, or a callable that picks one. A value is a line, or a list of steps, each a title or {"title", "status"} with status pending (the default), in_progress , complete or error :
The callable gets the agent's state as it is now, as {"state": ...} , so it can say which tool is to run (the last message's tool_calls ) or what's left on the to-do list. It is called as the run starts, before and after each model call, and every 4 s while a model or tool call runs, one call at a time. None , or an empty list (as a to-do list is before the agent writes one), leaves what's shown. A callable that raises, takes longer than 1 s, or returns something else leaves it too, with one warning per run. The status is only posted when it changed, at most once a second, in the background, so it never slows the run; a failed post is logged. A sync callable runs in a thread, where the timeout cannot stop it, so bound any I/O it does.
Apps with Slack's agent view show a custom status as a plan above the : the line is the plan's title and each step one of its tasks. A step that's no longer listed is marked complete, since Slack can't remove one, and the plan reads "Done" when the run ends. Other apps show the line, or the first step not yet done, as the thread's status. Without status , nothing changes.
status=False shows no status and no Stop button, for an agent that works in the background. The , errors and approvals still show.
Replying from the agent
The channel posts the agent's last in the thread once a run succeeds. ="none" leaves replying to the agent instead, for an agent that posts its own messages, with runtime.channel.post or its own Slack client, or that answers somewhere else:
Reactions, the status, Stop and onFinish work as before. channels.linear and channels.http take the same option. Deploying ="none" needs an mda CLI from this release; an older one refuses it.
Buttons your agent posts
runtime.channel.post only sends what every channel can. For anything Slack-specific, such as buttons, feedback buttons or a message the agent updates later, the agent posts with its own Slack client. The app's bot token is the agent connection mda/slack-bot-token (reading it as a user connection raises), and runtime.channel.raw_event , the Slack event the run came from, names the thread: a message's own event, or a click's interaction payload, whose container says where the button was.
Trigger Server forwards a click on such a button to the channel. on_event 's "interaction" decides what it starts, as the other keys do for messages:
The handler gets a SlackInteractionEvent : action_id (the button's action_id , or a modal's callback_id ), value (the button's value , or the modal's state.values ), user_id , channel_id , message_ts (the message holding the button; None for a modal), thread_ts , actor , and Slack's interaction payload as payload , with its response_url and without its verification token . The run it starts runs on the button's thread. Return None for a click that starts nothing, such as a feedback_buttons rating you record yourself. An endpoint works here too, as does multitask_strategy .
Without "interaction" , a click starts a run with no new message, which reads the click from runtime.channel.event ( type "user_prompt_response" , with action and value ). A click that answers a decision the thread waits on resumes that run instead, and never reaches "interaction" . A click without a correlation ID never answers a tool-call review, which its own prompt answers: while the thread waits on one, such a click starts nothing. Trigger Server forwards clicks on buttons without a URL and on Slack's feedback_buttons ; selects and inputs aren't forwarded.
Setting up the Slack app
The first mda deploy of a Slack channel asks which Slack app it uses, as the GitHub and Linear channels do:
Create a new Slack app in your workspace : LangSmith creates and manages it, in the workspace you authorized LangSmith in. Deploy names the workspace.
Let LangSmith create and manage a new Slack app : the same, when you haven't authorized LangSmith in Slack yet. Deploy prints the link to do that.
Create a new Slack app yourself : Slack opens with the app filled in from a manifest. Install it, then paste its Bot User OAuth Token and Signing Secret into the prompts.
Use an existing Slack app : deploy lists the request URLs, bot events and scopes to set on the app, then asks for its token and signing secret. Slack sends an app's events to one URL, so whatever received them before stops receiving them.
Self-hosted LangSmith can't create Slack apps, so it offers only your own. LangSmith keeps the app's credentials, and later deploys keep whichever app the channel has without asking. The agent reads the app's bot token as the agent connection mda/slack-bot-token , so nothing goes into .env .
To skip the question, with or without a terminal, set MDA_SLACK_BOT_TOKEN and MDA_SLACK_SIGNING_SECRET in the shell or .env to your own app's bot token and signing secret. Deploy checks them before uploading. Only the CLI reads them: they are never uploaded to the deployment, and you can remove both once the channel is set up. Without a terminal and without them, hosted LangSmith creates a managed app in the workspace you already authorized it in, and says so. When you haven't authorized it yet, or on self-hosted LangSmith, deploy stops before uploading and says what to set.
When Slack still needs you during setup, to authorize LangSmith or to install the new app (some workspaces have an admin approve it first), deploy prints the link and waits, continuing as soon as Slack reports it done. In a terminal the link also opens in your browser, and Ctrl-C skips the channel. Without one, deploy waits up to an hour, so a coding agent running it can hand you the link; Ctrl-C stops it.
If a setup step fails, deploy offers to try again or to continue without the Slack channel. Without a terminal the failure ends the deploy, once the other channels are set up. See Setting up channels on deploy for when deploy sets the channel up.
The GitHub channel is a thin HTTP adapter. Add a channel file with event handlers:
A run acts for the GitHub user who sent the event, as their Agent Auth principal for (github, github.com, ) : GitHub signs each delivery, and the numeric ID outlives login renames. Events from bots and organizations run as the channel. Unless resolve_user maps it to one of your users (see Mapping channel senders to your users ), a GitHub sender is not a user of the agent's identity, the principal identity.py resolves from LangSmith, Supabase or another provider. So MCP servers and tools that act on a user's behalf or need a user connection are left out of those runs, with a warning, and the run goes on without them. An issue or pull request is a shared conversation, so the sender gets user memory only where the user memory layer's allow opts in. See Setting up the GitHub App for what the first deploy asks.
Pass app to narrow what the agent can reach. Deploy applies changes to it on every run:
With repositories , events from other repositories start nothing, and deploy reports listed ones the App is not installed on. The agent's token reaches every repository the App is installed on, so install it only on the ones the agent may change.
When the handled events, permissions or repositories change, mda deploy renews the agent's token once the installation grants what it needs. Handled events set their own permission level (read to receive an event, write to also where it happened), and permissions can raise it but not lower it. Deploy cannot change the App itself: GitHub reads an App's permissions from its manifest only when the App is created, so the App's owner grants added permissions, and removes dropped or lowered ones, in the App's settings. Deploy names both and links there. mda delete removes the App's connections from Agent Auth and links the App on GitHub, where its owner can delete it. The GH_* overrides are read at request time; the webhook secret and bot ID read from Agent Auth are cached for up to 5 minutes. A matched event fails closed if the bot ID is missing or invalid. Calling channels.github() without handlers preserves receipt-only behavior and needs only the webhook secret.
Issues: issues.opened , issues.edited , issues.reopened , issues.labeled , issue_comment.created , issue_comment.edited .
Pull requests: pull_request.opened , pull_request.edited , pull_request.reopened , pull_request.ready_for_review , pull_request.converted_to_draft , pull_request.synchronize , pull_request.labeled , pull_request.closed .
Reviews: pull_request_review.submitted , pull_request_review.edited , pull_request_review.dismissed , pull_request_review_comment.created , pull_request_review_comment.edited .
Code and CI: push , status , check_run.completed , check_suite.completed , workflow_run.completed . push and status have no action, so their key is the event name. A CI event continues a pull request's conversation when it ran for exactly one pull request.
Merge queue: merge_group.checks_requested , merge_group.destroyed . A merge group belongs to no conversation, so each delivery gets its own thread.
GitHub sends no event for a mention, so each event lists the handles the text it wrote mentions in event.mentions : the body of a new or edited , review or review , or the title and body of an opened or edited issue or pull request. An edit lists only the handles it added, so fixing a typo doesn't mention anyone again. Events that write no text, such as a push to a pull request, a label or a reopen, list none, even when the body they belong to mentions someone. Handles are lowercased, listed once, in order, and read as GitHub links them: @octocat or @octo-org/reviewers , not team@octo.dev , and not in code, quotes or HTML , such as a pull request template's . Any text tag counts, such as @openswe , even one that is no GitHub account. A handler that answers mentions checks the list:
An issue on a pull request has issue.pull_request set, and an edit says what it changed in payload.changes .
While a conversation's run is still going, a new event that starts a run waits for it by default. multitask_strategy changes that, using LangGraph's names: "interrupt" cancels the active run and keeps its progress, "rollback" cancels it and discards its progress, and "reject" starts nothing. For example, channels.github(multitask_strategy="interrupt", on_event=...) lets a newer replace the work on an older one. Events on a conversation that waits on an interrupt start nothing either way. The authoring types describe supported keys and callable handlers. Configuration is application code; incoming webhook payloads are validated at runtime.
Signatures are verified against the raw bytes. Ping returns 200; other valid receipts return 202. An unconfigured event or the App's own activity starts nothing. The App's own activity is what the agent does with the App's token, such as its , its pushes or a pull request it opened; set include_own_events=True to hand those to handlers too, with event.from_app set. A handler that answers or reviews then skips event.from_app , or the agent answers itself. The request awaits the configured callback and run creation before acknowledgment (an endpoint's is asked after; see "Asking your service what to start"); synchronous and async callbacks are supported. A handler returns what agent.invoke takes: a nonblank string (one user message), a message such as HumanMessage(...) with text or content blocks, state such as {"messages": [...], "todos": []} , or (input, {"context": {...}, "metadata": {...}}) to also set the run's context ( context["channel"] is reserved) or metadata, such as {"issue": "ENG-123"} to find the run by in LangSmith. Metadata keys are letters, digits, _ , . or - . Keys the Agent Server and LangSmith set are reserved: mda_ , langgraph_ and ls_ keys, and ids such as thread_id , session_id , run_id and user_id . "webhook": url has the Agent Server POST the finished run (its status, metadata, values and any error) to url , as runs.create(webhook=...) does; http(s), without credentials in the URL. The handler's second argument is the conversation's thread : thread.id is the thread the run starts on, for context that names it, such as a token your backend signs for the thread. None skips without a thread or run. Other results and callback failures are safely logged and start nothing.
Each issue or pull request has one thread, so the agent keeps the conversation: an issue, its , and a pull request with its reviews and review continue the same thread, as does a workflow run for exactly one pull request. Other events get a thread of their own. A redelivered webhook starts nothing, because each thread runs a delivery once. A that arrives while the agent is still working waits for that run to finish, so it never skips a decision the run stops for. There is no automatic retry.
Handlers can call GitHub with a client of your choice and the App's installation token from await connections.get("mda/github-token", {"type": "agent"}) , which resolves outside a run too. Agent-written values can hold anything, so escape them before posting.
A run can still stop on an interrupt: a review from interrupt_on , or a value the agent passed to interrupt() . The GitHub channel neither asks for nor answers interrupts. When a run stops on one, the run itself with a link to the thread in LangSmith Studio where the decision is made, in the LangSmith environment mda deploy recorded. It does so as it ends, so a run that Studio resumes, or a scheduled run, that stops again too. While the conversation waits, events on it start nothing and get the same link. Anyone with access to the deployment's LangSmith workspace can answer there, reviews included; Studio can only resume a thread's interrupts, not start new turns in it. The resumed run uses no user connections, even though a person answered: the conversation holds content from outside the workspace, which must not act with the grants of whoever resumes it from Studio.
To acknowledge an event the moment it arrives, such as with a 👀 reaction, pass on_received(event, thread) . It hears each delivery of a handled event once, with the parsed event and its thread, as soon as the delivery reaches its thread: before MDA reads the thread or asks the handler, which under the default enqueue waits until a busy conversation's run has finished. It fires even when the thread then waits on an interrupt or the handler declines, so apply your own filters there, such as checking event.mentions . It runs in the background, before on_finish ; a failure is logged and doesn't stop the run.
Keep callbacks short: their work and run creation must fit within GitHub's webhook response window. A handler for an event that waits for a busy conversation runs once that run has finished, after the webhook was acknowledged. The request does not wait for agent completion. Run-start failures return 500; skipped or failed callbacks are acknowledged without a run.
Callbacks receive a normalized event and its thread ( thread.id , thread.channel.name , and thread.interrupted while it waits on an interrupt). The event includes the original payload, delivery and installation IDs, repository and sender. Types describe handwritten subsets, not the complete GitHub schema. Run code can inspect the normalized event through runtime.thread.origin.channel.raw_event . Logs correlate the GitHub delivery ID to the fresh thread and run IDs without printing the payload. GitHub handler returned run input records the callback decision; channel run started confirms run creation.
Each issue or pull request's thread belongs to that GitHub conversation, whoever starts its runs. User connections, message-list results and automatic GitHub replies are not supported. To act on GitHub from a run ( , label, open pull requests), give the agent a GitHub MCP server in tools/mcp.py .
Setting up the GitHub App
The first mda deploy of a GitHub channel asks which GitHub App it uses, as the Slack and Linear channels do:
Create a new GitHub App : deploy asks which account should own it, an organization or your personal account, then opens GitHub with the App filled in and named after the agent. Create it, then install it on the repositories the agent may reach.
Use an existing GitHub App : enter its App ID, private key file and webhook secret. Deploy records the installation GitHub reports. It asks you to pick one when the App is installed in several accounts, opens the install page when it's installed nowhere, and asks for the installation ID only when GitHub can't be checked.
Agent Auth keeps the App's key, webhook secret and bot ID, so nothing goes into .env , and later deploys keep the App without asking. An App has one webhook URL: if an existing App's webhook points somewhere else, deploy asks before moving it to the deployment. Answer "No" to keep it there, for example when another service receives the App's events and forwards the ones for this agent to /channels/github/events with the body and GitHub's headers unchanged. Deploy remembers that URL and doesn't ask again, with or without a terminal, until the App's webhook moves. If the App's installation lacks a permission the channel needs, deploy names it.
To skip the questions, with or without a terminal, set these in the shell or .env :
MDA_GITHUB_APP_OWNER : create a new App owned by this organization, or by @me , the personal account of whoever creates it.
MDA_GITHUB_APP_ID , MDA_GITHUB_APP_PRIVATE_KEY_FILE (the path to its .pem file) and MDA_GITHUB_WEBHOOK_SECRET : use this existing App instead. Add MDA_GITHUB_APP_INSTALLATION_ID when it's installed in several accounts.
MDA_GITHUB_WEBHOOK_SECRET alone: the webhook secret of an existing App whose secret Agent Auth doesn't have yet.
MDA_GITHUB_WEBHOOK_ELSEWHERE : the URL an existing App's webhook keeps. Without a terminal, deploy otherwise stops when the webhook points elsewhere.
Deploy checks them before uploading. Only the CLI reads them: they are never uploaded to the deployment, and you can remove them once the channel is set up. Without a terminal and without an owner or an existing App, deploy stops before uploading and says what to set. During setup it prints the link for a person to open and waits up to an hour for them to finish. GH_WEBHOOK_SECRET and GH_APP_BOT_ID (the App bot account's numeric user ID) are different: the deployment reads them, and they override what Agent Auth stores.
If a setup step fails, deploy offers to try again or to continue without the GitHub channel. Without a terminal the failure ends the deploy, once the other channels are set up. See Setting up channels on deploy for when deploy sets the channel up.
The Linear channel receives a Linear app's webhooks. Each issue is one conversation, and each agent session on it another, and the run's is posted as a on the issue, in the thread of the that started the run:
Handled events are Issue.create , Issue.update , .create , AgentSessionEvent.created and AgentSessionEvent.prompted , named as Linear names them ( LinearEventKey ). Each key has its event class, such as LinearIssueUpdateEvent , whose payload is that key's payload type, such as LinearIssueUpdatePayload ; LinearEvent is any of them. An unknown key in on_event raises. The channel verifies each delivery's Linear-Signature and rejects deliveries older than a minute. It ignores events teams outside app["teams"] , changes by other apps and integrations (pass ignore_bots=False to keep them), and the app's own and changes.
Experimental. Agent sessions use Linear's Agents API, which is a Developer Preview, so they may change as Linear changes it. Issue and events don't depend on it.
Experimental. Agent sessions use Linear's Agents API, which is a Developer Preview, so they may change as Linear changes it. Issue and events don't depend on it.
Agent sessions are on by default ( sessions=False turns them off). Mentioning the app or delegating an issue to it opens a Linear agent session. The channel acknowledges it at once and links it to the run's thread in Studio. Without a handler, the run starts with Linear's prompt for the session ( promptContext ), and a in the session continues the conversation. Each session is a thread of its own. The run's appears in the session, and Stop cancels that session's run. A run that stops on interrupts, such as a review from interrupt_on , answers as it ends with a link to its thread in LangSmith Studio, where the decision is made, also when Studio resumed it; replies in the session meanwhile get the same link. that a session already delivers, such as the mention itself and replies in the session, don't also reach a .create handler.
app also names the app deploy asks the admin to create: name (2-80 characters, without "Linear"; defaults to the agent's name), description , and icon , a PNG or JPEG given as a path relative to channels/ like the Slack channel's, such as assets/icon.png (at least 256×256 pixels, at most 1 MB). The deployment serves it at /channels/ /icon , and deploy points the app's icon there. They apply only when deploy creates the app: Linear has no API to change an app, so later changes to them do nothing. Change an existing app on its settings page in Linear; deploy reminds you of this when it installs the app.
mda deploy sets up the Linear app, which takes a Linear workspace admin; see Setting up the Linear app .
The channel reads the webhook signing secret from Agent Auth, or from LINEAR_WEBHOOK_SECRET when set. It acts as the app through the deployment's Agent Auth app, whose OAuth connection is mda/linear-app/ , installed with actor=app ; read its token with await connections.get("mda/linear-token", {"type": "agent"}) to call Linear's API from tools.
="none" leaves the run's answer to the agent: the channel doesn't post it as a or in the session. Session acknowledgements, Stop and error notices still post.
Setting up the Linear app
The first mda deploy of a Linear channel asks which Linear app it uses, as the Slack and GitHub channels do. Setting it up takes a Linear workspace admin:
Create a new Linear app : Linear has no public API to create apps, so deploy asks for the workspace's URL key (as in / ) and opens Linear's new-app page in that workspace, filled in with the app's name, redirect URI, webhook URL ( /channels/linear/events ) and events. The admin creates the app and pastes its client ID, client secret and webhook signing secret into deploy's prompts.
Use an existing Linear app : deploy lists the redirect URI, webhook URL and events to set on the app's settings page, then asks for the same three values. Linear sends an app's webhooks to one URL, so whatever received them before stops receiving them.
Deploy then opens the install page, where the admin approves the app for the workspace. Agent Auth keeps the credentials and the agent's token, so nothing goes into .env , and later deploys keep the app without asking. If Linear stops renewing the app's access, the deploy keeps the app and only asks an admin to approve it again. Linear has no API to change an app, so when the channel's app settings change or the deployment moves to another URL, update the app on its settings page.
To skip the questions, with or without a terminal, set MDA_LINEAR_CLIENT_ID , MDA_LINEAR_CLIENT_SECRET and MDA_LINEAR_WEBHOOK_SECRET in the shell or .env , and MDA_LINEAR_WORKSPACE to the ...
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
