Skip to main content

Examples

Use the public examples repo when you want a complete runnable workflow instead of isolated snippets: TryAgent examples on GitHub The repo is generated from the private TryAgent monorepo, so examples stay aligned with the SDK and product code. Manual edits in the public repo may be overwritten by the sync workflow.

Stock research review

The stock research example shows a portfolio workflow that escalates a high-risk equity memo to TryAgent before it reaches a client. High-risk research pauses twice using LangGraph interrupts: first for investment committee review, then again for compliance review of the client-facing memo. The CLI publishes each interrupt payload to TryAgent, and the graph is resumed with new Command({ resume: ... }) when the reviewer decision comes back. See Use LangGraph interrupts for the TryAgent integration pattern.
git clone https://github.com/hiredbyreact/tryagent-examples.git
cd tryagent-examples
corepack enable
corepack pnpm install
corepack pnpm --filter @tryagent/langgraph-stock-research-example start -- NVDA
NVDA follows the high-risk path and creates the first TryAgent escalation from a LangGraph interrupt. Use MSFT to see the lower-risk path complete without human review. Before running against TryAgent, create escalation policies and an API key, then export:
export TRYAGENT_API_KEY="ain_live_..."
export TRYAGENT_INVESTMENT_POLICY_KEY="research.investment_committee"
export TRYAGENT_COMPLIANCE_POLICY_KEY="research.compliance_review"
The example defaults to the production TryAgent API. Set TRYAGENT_BASE_URL only when you need to point it at a local or non-production environment.

Customer refund approval

The refund approval example shows a customer support workflow that escalates a risky refund request to TryAgent for human review. High-risk requests pause twice using LangGraph interrupts: first for refund approval, then again for customer message review.
corepack pnpm --filter @tryagent/customer-refund-approval-example start -- refund_high_value_late
refund_high_value_late follows the high-risk path and creates the first TryAgent escalation from a LangGraph interrupt. Use refund_low_value_duplicate_shipping to see the low-risk path complete without human review. For the refund example, create an escalation policy and export:
export TRYAGENT_POLICY_KEY="support.refund_approval"

Test locally

corepack pnpm test
See the quickstart for the underlying SDK call and signed resume callback flow, or Use LangGraph interrupts for the concrete LangGraph pause/resume pattern.