Skip to content

Commit 11f84d3

Browse files
committed
feat: Make it possible to copy the command for adding an agent directly in your projects
Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 5f02725 commit 11f84d3

File tree

2 files changed

+89
-27
lines changed

2 files changed

+89
-27
lines changed

src/components/AgentCard.tsx

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,27 @@ interface AgentCardProps {
66
}
77

88
export function AgentCard({ agent }: AgentCardProps) {
9-
const [copied, setCopied] = useState(false);
10-
9+
const [copiedImage, setCopiedImage] = useState(false);
10+
const [copiedCommand, setCopiedCommand] = useState(false);
1111

12-
const copyToClipboard = async () => {
12+
13+
const copyImageToClipboard = async () => {
1314
try {
1415
const imageUrl = `${agent.image.repository}:${agent.image.tag}`;
1516
await navigator.clipboard.writeText(imageUrl);
16-
setCopied(true);
17-
setTimeout(() => setCopied(false), 2000);
17+
setCopiedImage(true);
18+
setTimeout(() => setCopiedImage(false), 2000);
19+
} catch (err) {
20+
console.error('Failed to copy to clipboard:', err);
21+
}
22+
};
23+
24+
const copyCommandToClipboard = async () => {
25+
try {
26+
const command = `infer agents add ${agent.id}`;
27+
await navigator.clipboard.writeText(command);
28+
setCopiedCommand(true);
29+
setTimeout(() => setCopiedCommand(false), 2000);
1830
} catch (err) {
1931
console.error('Failed to copy to clipboard:', err);
2032
}
@@ -84,6 +96,35 @@ export function AgentCard({ agent }: AgentCardProps) {
8496
</div>
8597
</div>
8698

99+
{/* CLI Command with Copy Button */}
100+
<div className="mb-4">
101+
<span className="text-slate-400 text-xs uppercase tracking-wider mb-2 block">Add to CLI</span>
102+
<div className="flex items-center gap-1 p-2 bg-slate-900/50 rounded-xl border border-slate-700/30">
103+
<code className="flex-1 text-xs text-green-300 font-mono truncate">
104+
infer agents add {agent.id}
105+
</code>
106+
<button
107+
onClick={copyCommandToClipboard}
108+
className={`flex items-center justify-center w-6 h-6 rounded-lg transition-all duration-200 ${
109+
copiedCommand
110+
? 'bg-green-500/20 text-green-400'
111+
: 'bg-slate-700/50 hover:bg-slate-600/50 text-slate-300 hover:text-white'
112+
}`}
113+
title="Copy CLI command"
114+
>
115+
{copiedCommand ? (
116+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
117+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
118+
</svg>
119+
) : (
120+
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
121+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
122+
</svg>
123+
)}
124+
</button>
125+
</div>
126+
</div>
127+
87128
{/* OCI Image URL with Copy Button */}
88129
<div className="mb-6">
89130
<span className="text-slate-400 text-xs uppercase tracking-wider mb-2 block">OCI Image</span>
@@ -92,15 +133,15 @@ export function AgentCard({ agent }: AgentCardProps) {
92133
{agent.image.repository}:{agent.image.tag}
93134
</code>
94135
<button
95-
onClick={copyToClipboard}
136+
onClick={copyImageToClipboard}
96137
className={`flex items-center justify-center w-6 h-6 rounded-lg transition-all duration-200 ${
97-
copied
98-
? 'bg-green-500/20 text-green-400'
138+
copiedImage
139+
? 'bg-green-500/20 text-green-400'
99140
: 'bg-slate-700/50 hover:bg-slate-600/50 text-slate-300 hover:text-white'
100141
}`}
101142
title="Copy OCI image URL"
102143
>
103-
{copied ? (
144+
{copiedImage ? (
104145
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
105146
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
106147
</svg>

src/pages/HowToPage.tsx

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ curl -O https://raw.githubusercontent.com/inference-gateway/cli/main/examples/a2
106106
cp .env.gateway.example .env.gateway<br/><br/>
107107
# Key settings:<br/>
108108
ENVIRONMENT=development<br/>
109-
A2A_ENABLE=true<br/>
110-
A2A_EXPOSE=true<br/>
111-
A2A_AGENTS=http://google-calendar-agent:8080,http://documentation-agent:8080<br/>
112109
SERVER_HOST=0.0.0.0<br/>
113110
SERVER_PORT=8080<br/><br/>
114111
# Add your API keys for providers (Anthropic, OpenAI, etc.)
@@ -260,19 +257,15 @@ networks:
260257
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
261258
⚙️ 2. Gateway Configuration
262259
</h3>
263-
<p className="text-slate-300 mb-4">The gateway is configured to enable A2A protocols and connect multiple LLM providers:</p>
260+
<p className="text-slate-300 mb-4">The gateway is configured to connect multiple LLM providers:</p>
264261
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
265262
<pre className="text-green-400 text-sm whitespace-pre overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-track]:bg-slate-800 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb:hover]:bg-slate-500">
266263
{`# Key gateway settings (.env.gateway):
267264
268-
# A2A Protocol Configuration
269-
A2A_ENABLE=true
270-
A2A_EXPOSE=true
271-
A2A_AGENTS='http://google-calendar-agent:8080,http://documentation-agent:8080,http://n8n-agent:8080'
272-
273265
# Server Configuration
274266
SERVER_HOST=0.0.0.0
275267
SERVER_PORT=8080
268+
ENVIRONMENT=development
276269
277270
# LLM Provider Support (add your API keys)
278271
# ANTHROPIC_API_KEY=
@@ -317,9 +310,6 @@ SERVER_PORT=8080
317310
SERVER_IDLE_TIMEOUT=130s<br/>
318311
A2A_CLIENT_TIMEOUT=130s<br/>
319312
CLIENT_TIMEOUT=130s<br/><br/>
320-
# A2A Configuration<br/>
321-
A2A_ENABLE=true<br/>
322-
A2A_EXPOSE=true<br/><br/>
323313
# Health check endpoint<br/>
324314
curl http://localhost:8080/health
325315
</code>
@@ -340,7 +330,38 @@ SERVER_PORT=8080
340330
<div className="space-y-6">
341331
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
342332
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
343-
🗣️ 1. Interactive CLI Interface
333+
⚡ 1. Quick Add from Registry
334+
</h3>
335+
<p className="text-slate-300 mb-4">The fastest way to add an agent is directly from the registry using the one-click copy feature:</p>
336+
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50 mb-4">
337+
<pre className="text-green-400 whitespace-pre overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-track]:bg-slate-800 [&::-webkit-scrollbar-thumb]:bg-slate-600 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb:hover]:bg-slate-500">
338+
{`# 1. Browse the agent registry at https://registry.inference-gateway.com
339+
# 2. Find an agent you want to use
340+
# 3. Click the copy button next to "Add to CLI" on the agent card
341+
# 4. Paste and run the command in your terminal
342+
343+
# Example command (copied from registry):
344+
infer agents add documentation-agent
345+
346+
# Example: Add multiple agents
347+
infer agents add google-calendar-agent
348+
infer agents add n8n-agent
349+
infer agents add browser-agent`}
350+
</pre>
351+
</div>
352+
<div className="mt-4 p-4 bg-emerald-900/20 border border-emerald-700/50 rounded-lg">
353+
<p className="text-emerald-200 text-sm">
354+
💡 <strong>Pro tip:</strong> Each agent card in the registry displays a ready-to-use CLI command.
355+
Simply click the copy icon next to the green command text to copy it to your clipboard, then paste
356+
it in your terminal. This automatically configures the agent with the correct ID and pulls the
357+
latest container image from the registry.
358+
</p>
359+
</div>
360+
</div>
361+
362+
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
363+
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
364+
🗣️ 2. Interactive CLI Interface
344365
</h3>
345366
<p className="text-slate-300 mb-4">Use the inference CLI for natural language interactions with agents:</p>
346367
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
@@ -364,7 +385,7 @@ docker compose run --rm infer-cli
364385

365386
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
366387
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
367-
🛠️ 2. Task-Based Debugging
388+
🛠️ 3. Task-Based Debugging
368389
</h3>
369390
<p className="text-slate-300 mb-4">Use the A2A debugger to submit specific tasks and monitor agent responses:</p>
370391
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
@@ -392,7 +413,7 @@ docker compose run --rm a2a-debugger tasks submit-streaming \\
392413

393414
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
394415
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
395-
🌐 3. HTTP API Integration
416+
🌐 4. HTTP API Integration
396417
</h3>
397418
<p className="text-slate-300 mb-4">Integrate A2A capabilities into your applications via HTTP API:</p>
398419
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
@@ -428,7 +449,7 @@ const data = await response.json();
428449

429450
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
430451
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
431-
🔄 4. n8n Workflow Automation
452+
🔄 5. n8n Workflow Automation
432453
</h3>
433454
<p className="text-slate-300 mb-4">Use the n8n agent to generate and execute automated workflows:</p>
434455
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
@@ -470,7 +491,7 @@ docker compose logs -f n8n-agent`}
470491

471492
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
472493
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
473-
🔄 5. Multi-Agent Workflows
494+
🔄 6. Multi-Agent Workflows
474495
</h3>
475496
<p className="text-slate-300 mb-4">Create complex interactions that span multiple agents automatically:</p>
476497
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">
@@ -499,7 +520,7 @@ docker compose logs -f documentation-agent`}
499520

500521
<div className="bg-slate-800/50 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-6">
501522
<h3 className="text-xl font-semibold text-white mb-4 flex items-center gap-2">
502-
📊 5. Monitoring and Observability
523+
📊 7. Monitoring and Observability
503524
</h3>
504525
<p className="text-slate-300 mb-4">Track A2A communication and agent performance:</p>
505526
<div className="bg-slate-900 rounded-lg p-4 border border-slate-700/50">

0 commit comments

Comments
 (0)