1
import { createHarness } from '@strands-agents/harness'
2
import { tool } from '@strands-agents/sdk'
3
import z from 'zod'
4
5
const classifyLead = tool({
6
name: 'classify_lead',
7
description: 'Score and classify a lead.',
8
inputSchema: z.object({
9
email: z.string(),
10
company: z.string(),
11
}),
12
callback: ({ email, company }) => {
13
const data = crm.lookup(company)
14
return {
15
leadId: crm.createLead(email, company),
16
score: computeIcpScore(data),
17
segment: data.industry,
18
}
19
},
20
})
21
22
const routeToRep = tool({
23
name: 'route_to_rep',
24
description: 'Assign a lead to a rep.',
25
inputSchema: z.object({
26
leadId: z.string(),
27
region: z.string(),
28
}),
29
callback: ({ leadId, region }) => {
30
const rep = crm.getRepForRegion(region)
31
crm.assign(leadId, rep)
32
return `Assigned to ${rep}`
33
},
34
})
35
36
const agent = await createHarness({
37
tools: [classifyLead, routeToRep],
38
})
39
40
await agent.invoke(
41
'New lead: jane@acme.com, Acme Corp, US-West'
42
)
1
from strands import tool
2
from strands_harness import create_harness
3
4
@tool
5
def classify_lead(email: str, company: str) -> dict:
6
"""Score and classify a lead."""
7
data = crm.lookup(company)
8
return {
9
"lead_id": crm.create_lead(email, company),
10
"score": compute_icp_score(data),
11
"segment": data["industry"],
12
}
13
14
@tool
15
def route_to_rep(lead_id: str, region: str) -> str:
16
"""Assign a lead to a rep."""
17
rep = crm.get_rep_for_region(region)
18
crm.assign(lead_id, rep)
19
return f"Assigned to {rep}"
20
21
agent = create_harness(tools=[classify_lead, route_to_rep])
22
agent("New lead: jane@acme.com, Acme Corp, US-West")
1
import { createHarness } from '@strands-agents/harness'
2
import { tool } from '@strands-agents/sdk'
3
import z from 'zod'
4
5
const issueRefund = tool({
6
name: 'issue_refund',
7
description: 'Process a customer refund.',
8
inputSchema: z.object({ orderId: z.string(), amount: z.number() }),
9
callback: ({ orderId, amount }) => payments.refund(orderId, amount),
10
})
11
12
const agent = await createHarness({
13
instructions: 'Support assistant. Use the KB. Refunds require approval.',
14
tools: [issueRefund],
15
mcpServers: { kb: { command: 'uvx', args: ['kb-server'] } },
16
interventions: 'Ask before issuing any refund.',
17
})
18
19
await agent.invoke('Order A1234 wants a $40 refund. Policy, and can you process it?')
1
from strands import tool
2
from strands_harness import create_harness
3
4
@tool
5
def issue_refund(order_id: str, amount: float) -> str:
6
"""Process a customer refund."""
7
return payments.refund(order_id, amount)
8
9
agent = create_harness(
10
instructions="Support assistant. Use the KB. Refunds require approval.",
11
tools=[issue_refund],
12
mcp_servers={"kb": {"command": "uvx", "args": ["kb-server"]}},
13
interventions="Ask before issuing any refund.",
14
)
15
agent("Order A1234 wants a $40 refund. Policy, and can you process it?")
1
import { createHarness } from '@strands-agents/harness'
2
3
// Web fetch and search are built in, on by default.
4
const agent = await createHarness({
5
instructions: 'Research the goal, fetch sources, cite them.',
6
})
7
8
await agent.invoke(
9
'Summarize recent advances in solid-state batteries from https://en.wikipedia.org/wiki/Solid-state_battery'
10
)
1
from strands_harness import create_harness
2
3
# Web fetch and search are built in, on by default.
4
agent = create_harness(instructions="Research the goal, fetch sources, cite them.")
5
agent(
6
"Summarize recent advances in solid-state batteries from https://en.wikipedia.org/wiki/Solid-state_battery"
7
)
1
# strands-robots is Python-first — toggle to Python for the sample.
2
3
from strands_harness import create_harness
4
from strands_robots import Robot
5
6
robot = Robot("so100")
7
create_harness(tools=[robot])("pick up the red cube")
1
from strands_harness import create_harness
2
from strands_robots import Robot
3
4
# MuJoCo sim by default — no GPU, no hardware.
5
# Pass mode="real" to drive a physical robot with the same code.
6
robot = Robot("so100")
7
8
agent = create_harness(tools=[robot])
9
agent("pick up the red cube")
10
11
# Every robot is a Zenoh peer — coordinate a fleet:
12
robot.mesh.tell(robot.mesh.peers[0]["peer_id"],
13
"hold the tray steady")