techlist.io

Json Schema

2 posts

Slack2025-12-013 min readCurated summary

Streamlining Security Investigations with Agents

Slack’s Security Engineering team uses a multi-agent AI system to investigate security alerts across billions of daily events. After finding that a single prompt produced inconsistent results, the team replaced it with a controlled workflow of specialized model invocations, structured outputs, and application-level orchestration. The resulting system improves consistency, enables evidence review, and allocates more capable models only where they add the most value. ## From Prompt Prototype to Controlled Workflow - The initial prototype consisted of a roughly 300-word prompt defining: - The analyst’s role - Available data sources - Investigation methodology - Report formatting - Response classifications - A stdio-based MCP server safely exposed selected security data sources to the model. - A coding-agent CLI served as the prototype execution environment. - Results varied significantly: - Sometimes the model cross-referenced evidence effectively. - Other times it reached convenient or unsupported conclusions too quickly. - Prompt refinements helped somewhat, but prompts were ultimately too limited for fine-grained process control. ## Structured Investigation Tasks - Slack decomposed the investigation into a sequence of model invocations. - Each invocation performs one well-defined task and returns a structured output. - The application chains these tasks together and passes only the necessary context between stages. - Structured outputs use JSON schemas to constrain model responses. - They improve predictability, but can still fail when schemas are too complex and remain vulnerable to hallucination or attempts to circumvent constraints. - Guidance such as “question your evidence” became an explicit workflow step rather than merely an instruction in a prompt. ## Persona-Based Agent Architecture - Slack drew inspiration from research on meta-prompting, multi-persona collaboration, and security tabletop exercises. - Instead of representing multiple personas within one model call, Slack implemented each persona as an independent model invocation. - Every agent/task pair has: - A defined responsibility - A carefully designed output structure - Specific prompts and instructions - Potentially different models and tools - The application orchestrates the agents and controls how knowledge moves through the investigation. ## The Investigation Loop - **Director agent** - Guides the investigation from beginning to end. - Forms questions for domain experts. - Uses a journaling tool to plan and organize progress. - Decides how to continue based on reviewed findings and timelines. - **Expert agents** - Investigate questions using specialized knowledge and data sources. - Slack currently uses four domains: - **Access:** Authentication, authorization, and perimeter services - **Cloud:** Infrastructure, compute, orchestration, and networking - **Code:** Source code and configuration management - **Threat:** Threat intelligence and analysis - **Critic agent** - Acts as a meta-expert reviewing domain findings. - Applies a defined rubric to assess quality. - Adds analysis and credibility scores to individual findings. - Helps identify reliable evidence and reduce hallucinations. - Returns its conclusions to the Director, closing the investigation loop. - The Critic’s mildly adversarial role provides an independent challenge to expert conclusions. ## The Knowledge Pyramid - Different stages use different model capabilities and costs. - Domain experts operate at the base: - They query complex data sources. - They may make many tool calls. - Processing their results can consume substantial tokens. - The Critic reviews the larger set of expert findings and identifies the most valuable or credible evidence. - Higher-level reasoning can therefore use a smaller, more focused context. - Because each stage is independent, Slack can select different model versions, prompts, tools, and output formats for different tasks. Slack’s main recommendation is to treat complex agent behavior as an explicitly orchestrated workflow rather than relying on one increasingly elaborate prompt. Specialized agents, structured outputs, independent critique, and tiered model usage provide more predictable investigations while preserving the flexibility of AI-assisted analysis.

Anthropic2025-11-244 min readCurated summary

Introducing advanced tool use for Claude

# Anthropic's Advanced Tool Use: Tool Search, Programmatic Calling, and Usage Examples Anthropic argues that agents need to work with hundreds or thousands of tools without overloading their context window, call tools from code rather than one at a time, and learn correct usage from examples rather than schemas alone. To address this, the post introduces three beta features: Tool Search Tool, Programmatic Tool Calling, and Tool Use Examples. Internal testing shows these features cut token usage substantially while improving accuracy on tool-heavy tasks. ## Tool Search Tool Loading every tool definition upfront wastes context. A five-server MCP setup can consume about 55K tokens before a conversation starts, and Anthropic has seen definitions reach 134K tokens. Wrong tool selection is also common when names are similar, such as `notification-send-user` versus `notification-send-channel`. - Tools marked with `defer_loading: true` are excluded from the initial prompt. Claude sees only the search tool plus tools marked `defer_loading: false`. - When Claude needs a capability, it searches (regex, BM25, or a custom method such as embeddings), and only the matching tools expand into full definitions. - Entire MCP servers can be deferred with `mcp_toolset` configs, while frequently used tools stay loaded. - Because deferred tools are left out of the initial prompt, the system prompt and core tool definitions remain cacheable. - In the reported example, context use dropped from about 77K to 8.7K tokens, an 85% reduction. - Accuracy on MCP evaluations improved: Opus 4 went from 49% to 74%, and Opus 4.5 from 79.5% to 88.1%. - It suits setups with more than 10 tools or definitions over 10K tokens. It is less useful with fewer than 10 compact tools or tools used in every session, since the search step adds latency. ## Programmatic Tool Calling Conventional tool calling floods context with intermediate results and requires a full inference pass per call. Programmatic Tool Calling lets Claude write Python that orchestrates tools inside a sandboxed code execution environment, so Claude sees only the final output. - Tools opt in through `allowed_callers`, and the API exposes them as Python functions. - In the budget compliance example, a script fetches team members, budgets, and expenses for 20 people (about 200KB of raw data), and Claude receives only the one to three people who exceeded their limits (about 1KB). - Average token usage fell from 43,588 to 27,297 (37%) on complex research tasks, and accuracy improved on internal benchmarks. - Latency drops because 20+ tool calls can run in one code block instead of 20+ inference passes. - It is most useful for large datasets, workflows with three or more dependent calls, and parallel operations. Single calls and tasks where Claude must reason over every intermediate result gain little. - Claude for Excel uses this approach to handle spreadsheets with thousands of rows. ## Tool Use Examples JSON Schema defines structure but cannot show when optional parameters apply, which combinations make sense, or what format conventions an API expects. Ambiguous fields such as date formats, ID patterns, and nested objects often lead to malformed calls. - An `input_examples` array in the tool definition shows concrete calls, including minimal, partial, and full specifications. - Examples teach conventions such as `YYYY-MM-DD` dates, `USR-XXXXX` IDs, and which optional fields go with which priority levels. - In Anthropic's internal testing, accuracy on complex parameter handling rose from 72% to 90%. - Keep it to 1–5 realistic examples per tool, focused on ambiguity the schema doesn't resolve. Examples add tokens, so they are less useful for simple tools or standard formats like emails and URLs. ## Practical Recommendations Start with the bottleneck that limits your agent most: context bloat points to Tool Search, large intermediate results point to Programmatic Tool Calling, and parameter errors point to Tool Use Examples. The features complement each other, and clear tool names and descriptions improve search accuracy. The features are available in beta under the `advanced-tool-use-2025-11-20` header.