Start with an empty workspace, build a Faker-powered agent in the dashboard, and watch its first objective from code.
Start with an empty workspace and build a published agent that creates synthetic conference attendee records. You create every resource this guide uses: an API key, a Faker tool set, an agent, and its variation. You then dispatch an objective and stream its events from code.
Select API Keys, click Create API Key, and name the key Quickstart.Under Objectives, select Manage. This scope lets the key create objectives and read their event streams. Click Create API key, then copy the token.Find your workspace ID in the dashboard URL. It is the value after /w/, such as workspace_01KZ950VW79SJGDGEMQPAYYCXR.Export both values in your terminal:
The agent opens with a New Variation form. Name the variation Default and paste this into System prompt:
You create realistic synthetic conference attendee records for product demos and automated tests. For common attendee fields, use these Faker generators: name uses person.name, email uses internet.safe_email, phone uses phone.number, company uses company.name, job title uses company.job_title, city uses address.city, and country uses address.country. Call GenerateFake for every requested value. Use GetFakerOptions only when a requested field has no generator listed here. Complete the entire request before sending an assistant message. Never invent a value when Faker can generate it. Do not narrate or announce tool calls. Do not generate Social Security numbers, payment data, or passwords. Your only assistant message must be one concise JSON array with the requested fields and no surrounding prose.
Under Model configuration, select a model available in your workspace and set Temperature to 0.2. Set Max tool calls to 20, then click Create variation.
The configured Default variation
5
Assign Faker and publish
In the variation’s Assignments card, click Add, keep the assignment type on Tool Set, search for Faker MCP, and select it.
Faker MCP assigned to the variation
In the agent’s Details card, open the Draft status menu and select Publish. Published agents accept objectives.
Choose your language and run one example. Each request uses the agent’s external ID, so you do not need to copy its Cadenya ID.
import Cadenya from '@cadenya/cadenya';const client = new Cadenya({ apiKey: process.env['CADENYA_API_KEY'] });const workspaceId = process.env['CADENYA_WORKSPACE_ID']!;const objective = await client.objectives.create({ workspaceId, agentId: 'external_id:conference-attendee-generator', systemPromptData: {}, firstUserMessage: 'Create two conference attendee records with a name, email, phone, company, job title, city, and country. Return JSON.',});console.log(objective.metadata.id);
package mainimport ( "context" "log" "os" "go.cadenya.com/cadenya-go" "go.cadenya.com/cadenya-go/option")func main() { client := cadenya.NewClient( option.WithWorkspaceID(os.Getenv("CADENYA_WORKSPACE_ID")), ) objective, err := client.Objectives.New(context.Background(), cadenya.ObjectiveNewParams{ AgentID: "external_id:conference-attendee-generator", SystemPromptData: map[string]any{}, FirstUserMessage: cadenya.String("Create two conference attendee records with a name, email, phone, company, job title, city, and country. Return JSON."), }) if err != nil { log.Fatal(err) } log.Println(objective.Metadata.ID)}
require "cadenya"client = Cadenya::Client.new(api_key: ENV["CADENYA_API_KEY"])objective = client.objectives.create( workspace_id: ENV["CADENYA_WORKSPACE_ID"], agent_id: "external_id:conference-attendee-generator", system_prompt_data: {}, first_user_message: "Create two conference attendee records with a name, email, phone, company, job title, city, and country. Return JSON.")puts objective.metadata.id
curl "https://api.cadenya.com/v1/workspaces/${CADENYA_WORKSPACE_ID}/objectives" \ -H "Authorization: Bearer ${CADENYA_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "agentId": "external_id:conference-attendee-generator", "systemPromptData": {}, "firstUserMessage": "Create two conference attendee records with a name, email, phone, company, job title, city, and country. Return JSON." }'
The create call returns while the objective is Pending. Open Objectives in the dashboard and select the returned objective ID. Its timeline shows the Faker tool calls, their results, and the agent’s JSON response.
An event stream starts with events emitted after the connection opens. Create another objective and connect immediately so a short run cannot finish before the watcher is ready. Choose an example to watch the agent’s messages and tool activity through server-sent events.
import Cadenya from '@cadenya/cadenya';const client = new Cadenya({ apiKey: process.env['CADENYA_API_KEY'] });const workspaceId = process.env['CADENYA_WORKSPACE_ID']!;const objective = await client.objectives.create({ workspaceId, agentId: 'external_id:conference-attendee-generator', systemPromptData: {}, firstUserMessage: 'Create one conference attendee record with a name and email. Return JSON.',});const stream = await client.objectives.streamEvents( objective.metadata.id, { workspaceId },);events:for await (const event of stream) { const data = event.data; switch (data.type) { case 'toolCalled': { const called = data.toolCalled.tool; const name = called?.type === 'tool' ? called.tool.name : called?.type === 'agent' ? called.agent.name : '(built-in)'; console.log(`Tool called: ${name}`); break; } case 'toolResult': console.log(`Tool completed: ${data.toolResult.toolCallId}`); break; case 'assistantMessage': { const content = data.assistantMessage.content; if (content) console.log(content); break; } case 'finalized': case 'cancelled': case 'timedOut': case 'error': break events; }}
CADENYA_OBJECTIVE_ID="$( curl --silent \ "https://api.cadenya.com/v1/workspaces/${CADENYA_WORKSPACE_ID}/objectives" \ -H "Authorization: Bearer ${CADENYA_API_KEY}" \ -H "Content-Type: application/json" \ -d '{ "agentId": "external_id:conference-attendee-generator", "systemPromptData": {}, "firstUserMessage": "Create one conference attendee record with a name and email. Return JSON." }' | jq --raw-output '.metadata.id')"curl -N \ "https://api.cadenya.com/v1/workspaces/${CADENYA_WORKSPACE_ID}/objectives/${CADENYA_OBJECTIVE_ID}/events:stream" \ -H "Authorization: Bearer ${CADENYA_API_KEY}" \ -H "Accept: text/event-stream"
event.data is a discriminated union in the TypeScript SDK. Switching on data.type narrows data to the matching event interface, so fields such as toolCalled and assistantMessage are type-safe inside their cases.Both streams stay open because this agent has no structured output definition and can accept another message. Press Ctrl+C after the agent prints its final JSON response.
You now have a published agent that creates synthetic attendee data through a live MCP server, plus an event stream that exposes its work as it happens.