Drop console.agent(...) anywhere in your code to execute agentic workflows — as easy as console.log()
From guesswork to answers. One line changes everything.
Langchain requires 100+ lines of boilerplate. We need 1 line.
Existing tools are for chat apps, not runtime utilities.
Simple API, powerful capabilities. Zero config works.
Get running in under 30 seconds. No config needed.
npm install @console-agent/agent
import '@console-agent/agent';
// Fire-and-forget — never blocks your app
console.agent("analyze this error", error);
// Blocking — await for structured results
const result = await console.agent("validate email", email);
// Persona shortcuts
console.agent.security("check for SQL injection", input);
console.agent.debug("why is this slow?", { duration, query });
console.agent.architect("review API design", endpoint);
console.agent(prompt, context?, options?)The main API. Call it like console.log().
// Simple — fire-and-forget
console.agent("explain this error", error);
// Await structured results
const result = await console.agent("analyze", data, {
persona: 'security',
model: 'gemini-3-flash-preview',
thinking: { level: 'high', includeThoughts: true },
});
console.log(result.success); // boolean
console.log(result.summary); // "SQL injection detected..."
console.log(result.confidence); // 0.94
console.log(result.data); // { vulnerability: "...", fix: "..." }
AgentResultinterface AgentResult {
success: boolean; // Overall task success
summary: string; // Human-readable conclusion
reasoning?: string; // Agent's thought process
data: Record<string, any>; // Structured findings
actions: string[]; // Tools used / steps taken
confidence: number; // 0-1 confidence score
metadata: {
model: string;
tokensUsed: number;
latencyMs: number;
toolCalls: ToolCall[];
cached: boolean;
};
}
Auto-detected from your prompt keywords, or set explicitly.
OWASP security expert
Detects: injection, xss, vulnerability, csrf, exploit
console.agent.security("audit this query", sql);
Senior debugging expert
Detects: slow, error, optimize, crash, memory leak
console.agent.debug("why is this slow?", metrics);
Principal engineer
Detects: design, architecture, schema, scalability
console.agent.architect("review API", endpoint);
Full-stack senior engineer
Default fallback — handles everything else
console.agent("validate this data", records);
Opt-in tools that give your agent real-world capabilities. Only activated when you explicitly pass tools: [...].
Real-time web grounding
Search the web for up-to-date information, facts, CVEs, docs
const result = await console.agent(
"What is the current population of Tokyo?",
null,
{ tools: ['google_search'] }
);
Python sandbox (Gemini-hosted)
Run calculations, data processing, algorithm verification
const result = await console.agent(
"Calculate the 20th Fibonacci number",
null,
{ tools: ['code_execution'] }
);
// result.data.result → 6765
Fetch & analyze web pages
Read documentation, analyze APIs, extract page content
const result = await console.agent(
"Summarize this page",
null,
{ tools: ['url_context'] }
);
Tools can be combined — the agent decides which to use based on the prompt.
// Search + calculate in one call
const result = await console.agent(
"Search for the current world population, then calculate 1% of it",
null,
{ tools: ['google_search', 'code_execution'] }
);
// The agent will:
// 1. Use google_search to find current population
// 2. Use code_execution to calculate 1%
// 3. Return combined structured result
Zero config works. Customize when you need to.
import { init } from '@console-agent/agent';
import { z } from 'zod';
init({
apiKey: process.env.GEMINI_API_KEY,
model: 'gemini-2.5-flash-lite',
persona: 'general',
mode: 'fire-and-forget',
timeout: 10000,
budget: {
maxCallsPerDay: 100,
maxTokensPerCall: 8000,
costCapDaily: 1.00, // USD
},
anonymize: true, // Auto-strip secrets/PII
localOnly: false, // Disable cloud tools
dryRun: false, // Log without calling API
logLevel: 'info',
});
// ── Structured Output ────────────────────────
// Option A: Zod schema → typed, validated
const result = await console.agent(
"analyze sentiment", review,
{
schema: z.object({
sentiment: z.enum(["positive","negative","neutral"]),
score: z.number(),
keywords: z.array(z.string()),
}),
}
);
result.data.sentiment; // "positive" ✅ typed
// Option B: Plain JSON Schema (no Zod needed)
const info = await console.agent(
"extract info", text,
{
responseFormat: {
type: 'json_object',
schema: {
type: 'object',
properties: {
name: { type: 'string' },
age: { type: 'number' },
},
required: ['name', 'age'],
},
},
}
);
info.data.name; // "John Doe" ✅
Auto-strips API keys, emails, IPs, AWS keys, private keys, and connection strings before sending to AI.
Hard daily limits on calls (100/day), tokens (8K/call), and cost ($1.00/day). Prevents cost explosion.
Token bucket algorithm spreads calls evenly across 24 hours. Graceful degradation when limits hit.
Enable extended reasoning with thinking: { level: 'high' } for complex architecture and debugging tasks.
Code execution (Python sandbox), Google Search (real-time grounding), and file analysis (PDF, images, video).
Every call returns typed AgentResult. Pass a Zod schema or responseFormat (JSON Schema) for custom-shaped output.
| Model | Best For | Speed | Cost | Default |
|---|---|---|---|---|
gemini-2.5-flash-lite |
General purpose, fast | ~200ms | Very low | ✅ Default |
gemini-3-flash-preview |
Complex reasoning, thinking | ~400ms | Low |
console.agent.security("check for SQL injection", userInput)
console.agent.debug("why is this slow?", { duration, query })
await console.agent("validate batch meets schema", records)
console.agent.architect("review API design", { endpoint })
await console.agent("calculate optimal batch size", metrics)
console.agent("research CVEs for lodash@4.17.20")