Troubleshooting
Use this page to diagnose the most common LangChain SDK integration issues.
Middleware Not Connecting To OpenBox
Check that the required values are present before creating the middleware:
[ -n "$OPENBOX_URL" ] && echo "OPENBOX_URL is set" || echo "OPENBOX_URL is NOT set"
[ -n "$OPENBOX_API_KEY" ] && echo "OPENBOX_API_KEY is set" || echo "OPENBOX_API_KEY is NOT set"
Then verify:
OPENBOX_URLis passed asapi_urlOPENBOX_API_KEYis passed asapi_key.envis loaded beforecreate_openbox_langchain_middleware()if you usepython-dotenvvalidate=Trueis enabled in production so bad credentials fail during startup
If you get OpenBoxInsecureURLError, use HTTPS for non-localhost OpenBox URLs:
# Wrong
OPENBOX_URL=http://core.openbox.ai
# Correct
OPENBOX_URL=https://core.openbox.ai
DID Configuration Fails
DID signing is enabled by default for newly registered OpenBox agents. Configure both identity values:
OPENBOX_AGENT_DID=did:aip:your_agent_did
OPENBOX_AGENT_PRIVATE_KEY=your_agent_private_key
Common causes:
- Only one of
OPENBOX_AGENT_DIDorOPENBOX_AGENT_PRIVATE_KEYis set - The DID/private key belongs to a different OpenBox agent than the API key
- The key has been rotated in OpenBox but the runtime still uses the old value
- Signing is required in OpenBox but the runtime is configured as if signing is disabled
If Require signing is disabled for the agent in OpenBox, you can omit both identity values.
No Sessions In The Dashboard
If your agent runs but no sessions appear:
- Confirm
create_openbox_langchain_middleware()is called successfully - Confirm the returned middleware is passed to
create_agent(..., middleware=[middleware]) - Verify the API key belongs to the same agent you are viewing in OpenBox
- Run a full agent invocation, not only module import or agent construction
- Check network access from the runtime to
OPENBOX_URL
Tool Calls Do Not Show The Expected Type
Tool type is optional and comes from tool_type_map.
middleware = create_openbox_langchain_middleware(
api_url=os.environ["OPENBOX_URL"],
api_key=os.environ["OPENBOX_API_KEY"],
agent_did=os.environ["OPENBOX_AGENT_DID"],
agent_private_key=os.environ["OPENBOX_AGENT_PRIVATE_KEY"],
tool_type_map={
"search_web": "http",
"lookup_customer": "database",
},
)
The keys must match the LangChain tool names seen by the middleware.
Governance Blocks Or Halts The Agent
Governance exceptions mean OpenBox policy enforcement is working.
| Exception | Meaning |
|---|---|
GovernanceBlockedError | A model call, tool call, or hook operation was blocked |
GovernanceHaltError | The whole agent session should stop, including approval rejection or expiry |
GuardrailsValidationError | A configured guardrail matched restricted content |
ApprovalRejectedError | Lower-level direct approval polling received a rejection |
ApprovalExpiredError | Lower-level direct approval polling timed out |
To investigate:
- Open the OpenBox Dashboard
- Go to Agents
- Open the agent and latest run
- Review the event timeline and the policy or guardrail message
See Error Handling for handling patterns.
Approval Requests Do Not Appear
If your policy should require approval but no request appears:
- Confirm the policy returns
REQUIRE_APPROVAL, notBLOCK - Confirm the policy targets the correct event type and tool name/type
- Check the run timeline to see whether another policy blocked the event first
- Confirm the agent is connected to the expected OpenBox organization
See Approvals for the approval queue.
Missing HTTP, Database, Or File Telemetry
The LangChain SDK sends model and tool lifecycle events through middleware. It also initializes hook-level OpenTelemetry instrumentation for lower-level operations.
If lower-level telemetry is missing:
- Confirm the code path actually performs HTTP, database, or file I/O during the agent run
- For SQL telemetry, pass the SQLAlchemy engine through
sqlalchemy_engine - Confirm the operation happens inside the active agent invocation, not before middleware starts
- Check logs for OpenTelemetry setup warnings
Debug Logging
Enable SDK debug output:
OPENBOX_DEBUG=1 python agent.py
Then rerun the agent and inspect the OpenBox run timeline.
Next Steps
- Integration Walkthrough - Review the full wiring path
- Configuration - Check middleware options and identity setup
- Error Handling - Handle governance exceptions safely