{"id":13414045,"url":"https://github.com/staskobzar/goagi","last_synced_at":"2026-02-25T23:35:22.297Z","repository":{"id":40755930,"uuid":"196910277","full_name":"staskobzar/goagi","owner":"staskobzar","description":"AGI library for Go","archived":false,"fork":false,"pushed_at":"2024-06-21T00:29:59.000Z","size":163,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T01:14:33.811Z","etag":null,"topics":["agi","asterisk","fastagi","go","golang","library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/staskobzar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-15T02:32:56.000Z","updated_at":"2025-02-28T12:36:52.000Z","dependencies_parsed_at":"2024-10-26T17:29:18.245Z","dependency_job_id":null,"html_url":"https://github.com/staskobzar/goagi","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/staskobzar/goagi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staskobzar%2Fgoagi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staskobzar%2Fgoagi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staskobzar%2Fgoagi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staskobzar%2Fgoagi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staskobzar","download_url":"https://codeload.github.com/staskobzar/goagi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staskobzar%2Fgoagi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29844889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"ssl_error","status_checked_at":"2026-02-25T22:37:25.960Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agi","asterisk","fastagi","go","golang","library"],"created_at":"2024-07-30T20:01:56.139Z","updated_at":"2026-02-25T23:35:22.281Z","avatar_url":"https://github.com/staskobzar.png","language":"Go","funding_links":[],"categories":["Third-party APIs","第三方api"],"sub_categories":["Utility/Miscellaneous","Fail injection","实用程序/Miscellaneous"],"readme":"# goagi: Golang library to build agi/fastagi applications\n\n[![Build Status](https://github.com/staskobzar/goagi/actions/workflows/ci.yml/badge.svg)](https://github.com/staskobzar/goagi/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/staskobzar/goagi/branch/master/graph/badge.svg)](https://codecov.io/gh/staskobzar/goagi)\n[![CodeFactor](https://www.codefactor.io/repository/github/staskobzar/goagi/badge)](https://www.codefactor.io/repository/github/staskobzar/goagi)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/staskobzar/goagi/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/staskobzar/goagi/?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/staskobzar/goagi)](https://goreportcard.com/report/github.com/staskobzar/goagi)\n![GitHub](https://img.shields.io/github/license/staskobzar/goagi)\n\n\n\nSimple library that helps to build AGI scripts or FastAGI servers with Go.\n```go\nimport \"github.com/staskobzar/goagi\"\n```\n\nAPI local documentation [link is here](docs/api.md) or \n[go.dev generated](https://pkg.go.dev/github.com/staskobzar/goagi) documentation.\n\n## Usage FastAGI\n\nAGI object is created with ```New``` [method](docs/api.md#func-new) with three arguments:\n- Reader [interface](docs/api.md#type-reader)\n- Writer [interface](docs/api.md#type-response)\n- Debugger [interface](docs/api.md#type-debugger)\n\nDebugger interface is required only for debugging and usually ```nil```. See below for more details.\n\nReader and Writer are interfaces are any objects that implement ```Read```/```Write``` methods\nand can be ```net.Conn```, ```tls.Conn```, ```os.Stdin```, ```os.Stdout``` or any other,\nfor example from packages ```strings```, ```bufio```, ```bytes```.\n\n```New``` method will read AGI session setup environment variables and provides interface\nto AGI commands. AGI environment variables and arguments can be accessed with \nmethods [```Env```](docs/api.md#func-agi-env) and [```EnvArgs```](docs/api.md#func-agi-envargs).\nIf AGI channel receives HANGUP message, the session will be marked as hungup. Hangup status\ncan be checked by method [```IsHungup```](docs/api.md#func-agi-ishungup).\n\n### Usage example for AGI:\n```go\n\timport (\n\t\t\"github.com/staskobzar/goagi\"\n\t\t\"os\"\n\t)\n\n\tagi, err := goagi.New(os.Stdin, os.Stdout, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tagi.Verbose(\"Hello World!\")\n```\n\n### Fast AGI example:\n```go\n\tln, err := net.Listen(\"tcp\", \"127.0.0.1:4573\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tgo func(conn net.Conn) {\n\t\t\tagi, err := goagi.New(conn, conn, nil)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tagi.Verbose(\"Hello World!\")\n\t\t}(conn)\n\t}\n```\n\nSee working examples in [examples/] folder.\n\nIndex of methods that implements AGI commands [see here.](docs/api.md)\n\n## Commands Response interface\n\nEvery AGI command method return interface [```Response```](docs/api.md#type-response).\nThis is interface that provides access to AGI response values.\nSuccess response example:\n```\n200 result=1 (speech) endpos=9834523 results=5\n```\nFail response example:\n```\n511 Command Not Permitted on a dead channel or intercept routine\n```\nThere are success  and error responses. \nResponse interface implements following methods:\n\n* ```Code() int```: response code: 200, 510 etc.\n* ```RawResponse() string```: returns full text of AGI response.\n* ```Result() int```: returns value of result= field.\n* ```Value() string```: returns response value field that comes in parentheses. For exmpale \"(timeout)\" in response \"200 result=1 (timeout)\".\n* ```Data() string```: returns text for error responses and dtmf values for command like GetData.\n* ```EndPos() int64```: returns value for endpos= field.\n* ```Digit() string```: return digit from digit= field.\n* ```SResults() int```: return value for results= field.\n\n## Debugger\n\nInterface that provides debugging capabilities with configurable output.\n\nExample of usage:\n\n```go\n\tdbg := logger.New(os.Stdout, \"myagi:\", log.Lmicroseconds)\n\tr, w := net.Pipe()\n\tagi, err := goagi.New(r, w, dbg)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaskobzar%2Fgoagi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaskobzar%2Fgoagi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaskobzar%2Fgoagi/lists"}