codi-api-agent 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
api_agent/__init__.py ADDED
@@ -0,0 +1,60 @@
1
+ """API Agent — a read-only, spec-driven agent over any API.
2
+
3
+ Point it at an **OpenAPI/Swagger** or **GraphQL** spec (or a **Postman / RAML / API Blueprint**
4
+ collection, which it auto-converts), ask in plain language, and it picks the right operations,
5
+ calls them (GET/query only), and answers with citations and an automated faithfulness check.
6
+
7
+ The LLM provider is any OpenAI-compatible endpoint (Groq / HuggingFace / Ollama / OpenAI),
8
+ selected through configuration so models stay swappable.
9
+
10
+ Quick start (programmatic):
11
+
12
+ from api_agent import Agent, Config, load_catalog
13
+
14
+ catalog = load_catalog("https://petstore3.swagger.io/api/v3/openapi.json")
15
+ agent = Agent(Config(api_key="...", base_url="https://api.groq.com/openai/v1"), catalog)
16
+ print(agent.run("how many pets are available?").answer)
17
+
18
+ Or launch the UI: ``api-agent`` (needs the ``[ui]`` extra).
19
+ """
20
+ from __future__ import annotations
21
+
22
+ from api_agent.agent import Agent
23
+ from api_agent.catalog import Catalog, Tool
24
+ from api_agent.config import Config
25
+ from api_agent.graphql_loader import load_catalog, load_graphql
26
+ from api_agent.openapi_loader import load_openapi, merge_catalogs, spec_label
27
+ from api_agent.sql_loader import load_sql_catalog
28
+ from api_agent.supervisor import Supervisor
29
+ from api_agent._version import __version__
30
+ from api_agent.schemas import (
31
+ AgentResult,
32
+ Citation,
33
+ Evidence,
34
+ Faithfulness,
35
+ RubricDimension,
36
+ RubricReport,
37
+ ToolCall,
38
+ )
39
+
40
+ __all__ = [
41
+ "Agent",
42
+ "Config",
43
+ "Catalog",
44
+ "Tool",
45
+ "AgentResult",
46
+ "Citation",
47
+ "Evidence",
48
+ "Faithfulness",
49
+ "RubricReport",
50
+ "RubricDimension",
51
+ "ToolCall",
52
+ "load_catalog",
53
+ "load_openapi",
54
+ "load_graphql",
55
+ "load_sql_catalog",
56
+ "Supervisor",
57
+ "merge_catalogs",
58
+ "spec_label",
59
+ "__version__",
60
+ ]
api_agent/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """`python -m api_agent` → launch the Streamlit UI (same as the `api-agent` command)."""
2
+ from api_agent.cli import main
3
+
4
+ if __name__ == "__main__":
5
+ main()
api_agent/_version.py ADDED
@@ -0,0 +1,2 @@
1
+ """Single source of truth for the package version. Bump this one line to release."""
2
+ __version__ = "0.3.1"