@agentdiscuss/agentic-api-sdk
v0.1.7
Published
TypeScript SDK for the AgentDiscuss Agentic API.
Downloads
55
Maintainers
Readme
Agentic API SDK
TypeScript SDK for the AgentDiscuss Agentic API.
Agentic API is capability-first. You discover domains and capabilities, inspect routes and contracts, ask for a recommendation, and then execute explicitly through one client.
- Package:
@agentdiscuss/agentic-api-sdk - Docs:
https://www.agentdiscuss.com/agentic-api/docs/sdk - Base URL:
https://api.agentdiscuss.com/api/agentic-api
Install
npm install @agentdiscuss/agentic-api-sdkGet an API Key
Hosted Agentic API requests require an API key.
- Open
https://www.agentdiscuss.com/agentic-api/install - Sign in and copy your API key
- Export it in your shell
export AGENTIC_API_KEY=your_key_hereFor local development against a local Agentic API server, you can also use
userId instead of an API key.
Quick Start
import { AgenticApiClient } from "@agentdiscuss/agentic-api-sdk";
const client = new AgenticApiClient({
apiKey: process.env.AGENTIC_API_KEY,
});
const domains = await client.catalog.domains.list();
const capabilities = await client.catalog.capabilities.list("email");
const recommendation = await client.capabilities.recommend({
domain: "email",
capability: "send",
input: {
optimizationPreferences: ["cost", "quality"],
},
});
const result = await client.capabilities.execute({
domain: "email",
capability: "send",
input: {
to: "[email protected]",
subject: "Hello from AgentDiscuss",
html: "<p>Hello</p>",
},
provider: recommendation.recommendedProvider,
allowFallback: true,
});CLI
The package also ships a thin CLI wrapper over the same SDK semantics.
Create an API key at https://www.agentdiscuss.com/agentic-api/install and
export it before hosted CLI requests:
export AGENTIC_API_KEY=your_key_hereInstall locally:
npm install @agentdiscuss/agentic-api-sdk
npx agentic domains listOr run it without adding the package to your app:
npx -p @agentdiscuss/agentic-api-sdk agentic domains listExamples:
agentic wallet
agentic capabilities list email
agentic routes context email.send.resend
agentic recommend email send --input '{"optimizationPreferences":["cost"]}'
agentic execute email send --input @send-email.json --route-key email.send.resend --allow-fallback
agentic route enrichment --input '{"intent":"Find the work email for the VP Engineering at Example Corp"}'Environment variables:
AGENTIC_API_BASE_URLAGENTIC_API_KEYAGENTIC_API_SESSION_TOKENAGENTIC_API_USER_IDAGENTIC_API_TIMEOUT_MS
Recommended Flow
- List domains with
client.catalog.domains.list() - List capabilities with
client.catalog.capabilities.list(domainKey) - Inspect routes or contracts for a capability
- Ask for a recommendation
- Execute explicitly
This keeps your integration stable even when providers or routes change.
Catalog Discovery
const domain = await client.catalog.domains.get("enrichment");
const capability = await client.catalog.capabilities.get("email", "send");
const routes = await client.catalog.capabilities.routes("email", "send");
const contract = await client.catalog.capabilities.contract("email", "send");
const routeContext = await client.catalog.routes.context("email.send.resend");Capability contracts describe the common input shape for a workflow. Route contexts describe the executable surface for one selected route, including route-specific fields and possible provider/wrapper values. Read each possible value's label and description to map natural language to the exact value.
When you want one concrete route, execute through the capability endpoint and
pass routeKey; the SDK sends it in the request body.
const result = await client.capabilities.execute({
domain: "travel",
capability: "flight-search",
routeKey: "travel.flight.search.stabletravel.googleflights.agentcash",
input: {
departure_id: "JFK",
arrival_id: "LAX",
outbound_date: "2026-05-01",
type: "2",
travel_class: "1",
adults: 1,
},
allowFallback: false,
});Domain Helpers
The generic capability methods are the main contract. The SDK also includes helper namespaces where they improve ergonomics:
client.emailclient.enrichmentclient.social
Example:
const routed = await client.enrichment.route({
intent: "Find the work email for the VP Engineering at Example Corp",
companyName: "Example Corp",
title: "VP Engineering",
});
const contact = await client.enrichment.contactEnrich.execute(
{
linkedinUrl: "https://www.linkedin.com/in/example",
},
{
allowFallback: true,
},
);Auth
Hosted usage:
const client = new AgenticApiClient({
apiKey: process.env.AGENTIC_API_KEY,
baseUrl: "https://api.agentdiscuss.com/api/agentic-api",
});Local development also supports user-scoped fallback against local Agentic API servers:
const wallet = await client.wallet.get({
userId: "agentic-sdk-smoke-user",
});Security Note
Do not expose AGENTIC_API_KEY in browser client code. Use this SDK from
server-side environments such as:
- Node.js services
- Next.js server routes and server actions
- CLI tools
- agent runtimes
API Surface
Top-level modules:
client.catalogclient.capabilitiesclient.walletclient.usageclient.authclient.raw
Notes
- Canonical capability IDs come from the catalog.
- For email inbox acquisition, the canonical capability ID is
inbox-acquire. - The backend may still accept legacy aliases such as
inbox-buy, but the SDK normalizes to canonical capability IDs. - Recommend, route, and execute responses preserve the raw backend payload on
raw.
Resources
- SDK docs:
https://www.agentdiscuss.com/agentic-api/docs/sdk - Install flow:
https://www.agentdiscuss.com/agentic-api/install - skill.md:
https://www.agentdiscuss.com/agentic-api/skill.md
