HTTP Channels for Managed Deep Agents
Summary
This session details the implementation of custom HTTP channels for Managed Deep Agents, enabling agents to receive inbound requests from external services that are outside the developer's direct control (e.g., HubSpot, Salesforce, or messaging providers like Photon/iMessage). The process involves defining the agent's instructions, integrating durable memory (Context Hub) for state management, and implementing critical functions—`verify` and `parse`—to securely process and extract data from raw inbound events. The architecture ensures the agent can maintain context across multiple user interactions via stable thread IDs.
Key takeaways
-
Use Case for HTTP Channels
Custom HTTP channels are necessary when an agent needs to handle inbound requests from external services or platforms where LangChain does not provide a built-in channel (e.g., Slack, HubSpot, or custom RCS/iMessage integrations).
-
Agent Data Flow and Components
The agent requires defining instructions, utilizing durable memory (Context Hub) for persistent state (like a ledger), and implementing a custom channel definition that includes `verify` and `parse` functions.
-
Handling Inbound Messages
0:03
The `verify` function ensures the incoming request is valid and secure. The `parse` function extracts relevant data (text, images) from the raw event JSON and passes it to the agent.
-
Maintaining User Context
0:04
To ensure continuity over time, the agent must manage threads by hashing the inbound message phone number into a UUID, allowing the agent to maintain context across multiple interactions.
-
Completing the Interaction Loop
0:05
A `post` hook is required to send the agent's successful response back to the channel provider (e.g., Photon), allowing the user to receive the final text message.
Technical details
-
Agent Setup and Memory
1s
The agent (Reflex, an expense-reporting agent) is scaffolded using TypeScript (or Python) and configured to store its ledger in durable memory via Context Hub. For production, external services should be used for ledger storage across multiple users.
-
Channel Implementation (Photon Example)
2s
Using Photon as the channel provider for iMessage/SMS, the setup requires defining a client, a verifier, and a parser. The parser must extract content (text or images) from the incoming event JSON and return it as a `type message` to the agent.
-
Thread Management
4s
Thread ID management is crucial for user experience. Users can be identified by hashing the inbound text message phone number into a UUID, ensuring all subsequent requests from that user are managed within the same thread.
-
Deployment and Tracing
7s
After deployment, interactions are traceable in LangSmith, allowing developers to review the full set of runs and see how data is written to the durable memory in Context Hub.
Mentioned resources
Channel & topics
Watch on YouTube · Back to latest
This independent, AI-assisted summary is provided for commentary and informational purposes. It may contain errors or omit important context. Please watch the original video for the creator's complete presentation. Video, thumbnail, and related copyrights belong to their respective owners.