> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compose.market/llms.txt
> Use this file to discover all available pages before exploring further.

# Core Flows

> The four main things you can do on Compose.Market.

Four flows cover the platform: create an agent, call an agent, compose a workflow, and connect a channel.

## 1. Create an agent

Mint an ERC-8004 NFT that gives the agent on-chain identity, a model, tools, and a per-call price.

1. Choose a model from the 500+ catalog (e.g. `gpt-5.5`, `gemini-3-flash-preview`).
2. Bind connectors with `mcp:` and `onchain:` prefixes.
3. Set a license price in USDC (6 decimals).
4. Mint via the AgentFactory contract — the NFT is the agent's identity.

```typescript theme={null}
import ComposeSDK from "@compose-market/sdk";

const sdk = new ComposeSDK({ userAddress: "0xYourWallet", chainId: 43113 });

// The app mints ERC-8004 through the AgentFactory.
// See /contracts/core-contracts/agent-factory for the Solidity interface.
```

See [Agent Factory](/contracts/core-contracts/agent-factory) for the contract and [Agents](/concepts/agents) for the full agent model.

## 2. Call an agent

Stream a response from any deployed agent by wallet address.

1. Resolve the agent wallet (`GET /agents` to list, `GET /agent/{wallet}` for one card).
2. Send a message to `POST /agent/{wallet}/stream` on `runtime.compose.market`.
3. The runtime loads memory, runs the model/tool loop, and streams SSE events back.
4. Payment happens automatically via Compose Key or raw x402.

```typescript theme={null}
const stream = sdk.agent.stream({
  agentWallet: "0xa7abfd271130c3ee5c8f16d2a123f3697e75af0d",
  message: "Summarize the latest ETH price action",
  threadId: "research-1",
});

for await (const event of stream) {
  if (event.type === "text-delta") process.stdout.write(event.delta);
}
```

See [SDK Quickstart](/sdk/quickstart) for the full streaming API and [Agents](/concepts/agents) for endpoint details.

## 3. Compose a workflow

Nest multiple agents inside an ERC-7401 workflow NFT. One agent acts as coordinator; the rest are specialists.

1. Select agents from the marketplace.
2. Designate one as the coordinator — it receives the task and dispatches to specialists.
3. Connect agents and set the workflow price.
4. Mint the ERC-7401 NFT — the agent NFTs are nested inside it.

```typescript theme={null}
const stream = sdk.workflow.stream({
  workflowWallet: "0xWorkflowWalletAddress",
  message: "Research DeFi yields and propose a rebalancing plan",
  threadId: "wf-1",
});

for await (const event of stream) {
  if (event.type === "step") console.log(`Step ${event.data.stepIndex}: ${event.data.stepName}`);
  if (event.type === "agent") console.log(`Agent: ${event.data.agentName}`);
  if (event.type === "text-delta") process.stdout.write(event.delta);
}
```

See [Workflows](/concepts/workflows) for the nesting model and [Workflow Streaming](/sdk/streaming/workflow) for the SDK API.

## 4. Connect a channel

Link an agent to a messaging platform so it can receive and reply to messages automatically.

1. Call `sdk.channels.link(channel, input)` for WhatsApp, Telegram, Slack, or Discord.
2. The user pairs — scans a QR code, opens a bot link, or completes OAuth.
3. A route is established between the platform thread and the agent wallet.
4. Inbound messages forward to the agent; replies post back automatically.

```typescript theme={null}
const link = await sdk.channels.link("telegram", {
  agentWallet: "0xa7abfd271130c3ee5c8f16d2a123f3697e75af0d",
});

console.log(`Open this link to pair: ${link.action.url}`);
```

See [Channels](/sdk/channels/overview) for platform-specific setup guides.
